OSDN Git Service

オランダ語プラグイン追加。
authorwordring <kouichi_pm@users.osdn.me>
Sat, 29 Aug 2015 06:07:20 +0000 (15:07 +0900)
committerwordring <kouichi_pm@users.osdn.me>
Sat, 29 Aug 2015 06:07:20 +0000 (15:07 +0900)
80 files changed:
languages/dutch/dutch.cpp [new file with mode: 0644]
languages/dutch/dutch.h [new file with mode: 0644]
languages/dutch/dutch.pro [new file with mode: 0644]
languages/dutch/dutch.qrc [new file with mode: 0644]
languages/dutch/image/netherlands.svg [new file with mode: 0644]
languages/english/english.cpp
languages/english/english.h
languages/english/english.pro
languages/language/language.h
languages/languages.pro
proxy/main.cpp
proxy/tm.js [deleted file]
proxy/tmdatabase.cpp
proxy/tmdatabase.h
proxy/tmeditorwidget.cpp
proxy/tmservice.h
proxy/tmsocket.cpp
proxy/tmsocket.h
proxy/tmtext.cpp
proxy/tmtext.h
proxy/wordring.ico
third-party/OleanderStemmingLibrary/BUILD.txt [new file with mode: 0644]
third-party/OleanderStemmingLibrary/Change Log.txt [new file with mode: 0644]
third-party/OleanderStemmingLibrary/TestStemmer [new file with mode: 0644]
third-party/OleanderStemmingLibrary/docs.zip [new file with mode: 0644]
third-party/OleanderStemmingLibrary/example.cpp [new file with mode: 0644]
third-party/OleanderStemmingLibrary/indexing/common_lang_constants.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/indexing/string_util.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/license.txt [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/danish_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/dutch_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/english_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/finnish_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/french_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/german_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/italian_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/norwegian_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/portuguese_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/russian_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/spanish_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/stemming.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/stemming/swedish_stem.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/utilities/debug_logic.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/utilities/safe_math.h [new file with mode: 0644]
third-party/OleanderStemmingLibrary/utilities/utilities.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/indexing/common_lang_constants.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/indexing/string_util.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/danish_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/dutch_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/english_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/finnish_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/french_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/german_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/italian_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/norwegian_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/portuguese_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/russian_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/spanish_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/stemming.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/stemming/swedish_stem.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/utilities/debug_logic.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/utilities/safe_math.h [new file with mode: 0644]
third-party/include/OleanderStemmingLibrary/utilities/utilities.h [new file with mode: 0644]
third-party/license/OleanderStemmingLibrary/license.txt [new file with mode: 0644]
third-party/license/gnome-icon-theme-3.12.0/AUTHORS [new file with mode: 0644]
third-party/license/gnome-icon-theme-3.12.0/COPYING [new file with mode: 0644]
third-party/license/gnome-icon-theme-3.12.0/COPYING_CCBYSA3 [new file with mode: 0644]
third-party/license/gnome-icon-theme-3.12.0/COPYING_LGPL [new file with mode: 0644]
third-party/license/mecab-0.996/AUTHORS [new file with mode: 0644]
third-party/license/mecab-0.996/BSD [new file with mode: 0644]
third-party/license/mecab-0.996/COPYING [new file with mode: 0644]
third-party/license/mecab-0.996/GPL [new file with mode: 0644]
third-party/license/mecab-0.996/LGPL [new file with mode: 0644]
third-party/license/mecab-ipadic-2.7.0-20070801/AUTHORS [new file with mode: 0644]
third-party/license/mecab-ipadic-2.7.0-20070801/COPYING [new file with mode: 0644]
third-party/license/openssl-1.0.2d/ACKNOWLEDGMENTS [new file with mode: 0644]
third-party/license/openssl-1.0.2d/LICENSE [new file with mode: 0644]
third-party/license/sodipodi-flags/COPYING [new file with mode: 0644]
third-party/license/sodipodi-flags/CREDITS [new file with mode: 0644]
third-party/license/tidy-html5/LICENSE.txt [new file with mode: 0644]

diff --git a/languages/dutch/dutch.cpp b/languages/dutch/dutch.cpp
new file mode 100644 (file)
index 0000000..9fddc5d
--- /dev/null
@@ -0,0 +1,130 @@
+#include "text.h"
+#include "settings.h"
+#include "dutch.h"
+
+#include "debug.h"
+
+DutchPlugin::DutchPlugin(QObject *parent)
+       : QObject(parent)
+{
+}
+
+void DutchPlugin::set_settings(Settings const *settings)
+{
+       m_settings = settings;
+}
+
+QString DutchPlugin::name() const { return QString("Dutch"); }
+
+int DutchPlugin::code() const { return QLocale::Language::Dutch; }
+
+QIcon DutchPlugin::icon() const
+{
+       return QIcon(":/image/netherlands.svg");
+}
+
+Text::pointer DutchPlugin::divide_into_sentences(QString string_)
+{
+       Text::pointer result = Text::create();
+       result->set_data(RangeData::create(0, string_.size() - 1));
+       QString cstring;
+       int begin_ = 0;
+       int tail_ = 0;
+
+       int state = 0;
+       for(int i = 0; i < string_.size(); i++)
+       {
+               unsigned short c = string_.at(i).unicode();
+               switch(state)
+               {
+               case 0: s0: state = 0;// 開始位置
+                       begin_ = i;
+                       tail_ = i;
+               case 1: state = 1;
+                       if(c == '.' || c == '?' || c == '!') state = 2;
+                       break;
+               case 2:
+                       if(c == ' ') state = 3;
+                       else state = 1;
+                       break;
+               case 3:
+                       if('A' <= c && c <= 'Z')
+                       {
+                               stuff_sentence(result, cstring, begin_, tail_);
+                               cstring.clear();
+                               goto s0;
+                       }
+                       state = 1;
+                       break;
+               }
+               tail_ = i;
+               cstring.push_back(c);
+       }
+       if(!cstring.isEmpty()) stuff_sentence(result, cstring, begin_, tail_);
+       return result;
+}
+
+Text::pointer DutchPlugin::divide_into_words(Text::pointer sentence)
+{
+       assert(sentence->size() == 0);
+       Text::pointer result = Text::create();
+       result->set_data(sentence->data());
+
+       QString const &string_ = sentence->string();
+       QString cstring;
+       int begin_ = 0;
+       int tail_ = 0;
+       for(int i = 0; i < string_.size(); i++)
+       {
+               unsigned short ch = string_.at(i).unicode();
+               if(('a' <= ch && ch <= 'z')
+                               || ('A' <= ch && ch <= 'Z')
+                               || ('IJ')
+                               || ('0' <= ch && ch <= '9')
+                               || ch == '-'
+                               || ch == '_')
+               {
+                       tail_ = i;
+                       cstring.append(ch);
+               }
+               else
+               {
+                       if(!cstring.isEmpty())
+                               result->append(stuff_word(result, cstring, begin_, tail_));
+                       cstring.clear();
+                       result->append(stuff_word(result, QString(ch), i, i));
+                       begin_ = i + 1;
+                       tail_ = begin_;
+               }
+       }
+       if(!cstring.isEmpty()) result->append(stuff_word(result, cstring, begin_, tail_));
+       return result;
+}
+
+QString DutchPlugin::normalize(QString string)
+{
+       return string.toLower();
+}
+
+void DutchPlugin::stuff_sentence(Text::pointer parent, QString string,
+                                                                       int begin_, int tail_)
+{
+       // 先頭の空白文字を取り除く。
+       while(string.startsWith(' '))
+       {
+               string.remove(0, 1);
+               ++begin_;
+       }
+       // 後方の空白文字を取り除く。
+       while(string.endsWith(' '))
+       {
+               string.remove(string.size() - 1, 1);
+               --tail_;
+       }
+       if(string.isEmpty()) return; // 空白文字を取り除いた結果、空になった場合、ここで終わる。
+
+       // センテンス追加。
+       Text::pointer s = Text::create(parent, string);
+       s->set_data(RangeData::create(begin_, tail_));
+       parent->append(s);
+}
diff --git a/languages/dutch/dutch.h b/languages/dutch/dutch.h
new file mode 100644 (file)
index 0000000..7d3954a
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef DUTCHPLUGIN_H
+#define DUTCHPLUGIN_H
+
+#include "language.h"
+
+#include <QObject>
+#include <QIcon>
+#include <QString>
+
+class DutchPlugin : public QObject, public Language
+{
+       Q_OBJECT
+       Q_INTERFACES(Language)
+       Q_PLUGIN_METADATA(IID  "net.wordring.tm.language/1.0")
+
+public:
+       explicit DutchPlugin(QObject *parent = 0);
+
+       void set_settings(Settings const *settings);
+
+       QString name() const;
+       int code() const;
+       QIcon icon() const;
+
+       Text::pointer divide_into_sentences(QString string);
+       Text::pointer divide_into_words(Text::pointer sentence);
+
+       QString normalize(QString string);
+
+private:
+       void stuff_sentence(Text::pointer parent, QString string,
+                                               int begin_, int tail_);
+
+private:
+       Settings const *m_settings;
+};
+
+#endif // DUTCHPLUGIN_H
diff --git a/languages/dutch/dutch.pro b/languages/dutch/dutch.pro
new file mode 100644 (file)
index 0000000..444f1d1
--- /dev/null
@@ -0,0 +1,51 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2015-08-28T14:07:13
+#
+#-------------------------------------------------
+
+QT       += core
+
+TARGET = dutch
+TEMPLATE = lib
+CONFIG += plugin c++11
+
+debug:DESTDIR = ../../proxy/debug/plugins
+release:DESTDIR = ../../proxy/release/plugins
+
+SOURCES += dutch.cpp
+
+HEADERS += dutch.h
+
+
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../utility/release/ -lutility
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../utility/debug/ -lutility
+else:unix: LIBS += -L$$OUT_PWD/../../utility/ -lutility
+
+INCLUDEPATH += $$PWD/../../utility
+DEPENDPATH += $$PWD/../../utility
+
+win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../utility/release/libutility.a
+else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../utility/debug/libutility.a
+else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../utility/release/utility.lib
+else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../../utility/debug/utility.lib
+else:unix: PRE_TARGETDEPS += $$OUT_PWD/../../utility/libutility.a
+
+win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../language/release/ -llanguage
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../language/debug/ -llanguage
+else:unix: LIBS += -L$$OUT_PWD/../language/ -llanguage
+
+INCLUDEPATH += $$PWD/../language
+DEPENDPATH += $$PWD/../language
+
+win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../language/release/liblanguage.a
+else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../language/debug/liblanguage.a
+else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../language/release/language.lib
+else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../language/debug/language.lib
+else:unix: PRE_TARGETDEPS += $$OUT_PWD/../language/liblanguage.a
+
+DISTFILES +=
+
+RESOURCES += \
+    dutch.qrc
+
diff --git a/languages/dutch/dutch.qrc b/languages/dutch/dutch.qrc
new file mode 100644 (file)
index 0000000..42c8ea5
--- /dev/null
@@ -0,0 +1,5 @@
+<RCC>
+    <qresource prefix="/">
+        <file>image/netherlands.svg</file>
+    </qresource>
+</RCC>
diff --git a/languages/dutch/image/netherlands.svg b/languages/dutch/image/netherlands.svg
new file mode 100644 (file)
index 0000000..58c722a
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"
+[
+ <!ATTLIST svg
+  xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">
+]>
+<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
+
+<!-- /Creative Commons Public Domain -->
+<!--
+<rdf:RDF xmlns="http://web.resource.org/cc/"
+    xmlns:dc="http://purl.org/dc/elements/1.1/"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+<Work rdf:about="">
+   <dc:title>SVG Graphic of the Dutch flag</dc:title>
+   <dc:rights><Agent>
+      <dc:title>Marc Maurer</dc:title>
+   </Agent></dc:rights>
+   <license rdf:resource="http://web.resource.org/cc/PublicDomain" />
+</Work>
+
+<License rdf:about="http://web.resource.org/cc/PublicDomain">
+   <permits rdf:resource="http://web.resource.org/cc/Reproduction" />
+   <permits rdf:resource="http://web.resource.org/cc/Distribution" />
+   <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" />
+</License>
+</rdf:RDF>
+-->
+<svg
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   version="1"
+   x="0.00000000"
+   y="0.00000000"
+   width="1062.98999"
+   height="708.661011"
+   id="svg378">
+  <defs
+     id="defs380" />
+  <rect
+     width="1062.98999"
+     height="708.661011"
+     rx="0.00000000"
+     ry="0.00000000"
+     x="0.00000000"
+     y="0.00000000"
+     style="font-size:12;fill:#ffffff;fill-rule:evenodd;stroke-width:1pt;"
+     id="rect171" />
+  <rect
+     width="1062.98999"
+     height="236.220001"
+     rx="0.00000000"
+     ry="0.00000000"
+     x="0.00000000"
+     y="475.558563"
+     style="font-size:12;fill:#21468b;fill-rule:evenodd;stroke-width:1pt;"
+     id="rect256" />
+  <rect
+     width="1062.98999"
+     height="236.220001"
+     x="0.00000000"
+     y="0.00000000"
+     style="font-size:12;fill:#ae1c28;fill-rule:evenodd;stroke-width:1pt;"
+     id="rect255" />
+</svg>
index 6f057ea..14012bf 100644 (file)
@@ -2,6 +2,8 @@
 #include "english.h"
 #include "settings.h"
 
+#include <string>
+
 #include "debug.h"
 
 EnglishPlugin::EnglishPlugin(QObject *parent)
@@ -105,6 +107,13 @@ QString EnglishPlugin::normalize(QString string)
        return string.toLower();
 }
 
+QString EnglishPlugin::stem(QString word)
+{
+       std::wstring buffer = word.toStdWString();
+       m_stemmer(buffer);
+       return QString::fromStdWString(buffer);
+}
+
 void EnglishPlugin::stuff_sentence(Text::pointer parent, QString string,
                                                                        int begin_, int tail_)
 {
index a636fb7..4784a37 100644 (file)
@@ -3,6 +3,8 @@
 
 #include "language.h"
 
+#include "OleanderStemmingLibrary/stemming/english_stem.h"
+
 #include <QObject>
 #include <QIcon>
 #include <QString>
@@ -26,6 +28,7 @@ public:
        Text::pointer divide_into_words(Text::pointer sentence);
 
        QString normalize(QString string);
+       QString stem(QString word);
 
 private:
        void stuff_sentence(Text::pointer parent, QString string,
@@ -33,6 +36,7 @@ private:
 
 private:
        Settings const *m_settings;
+       stemming::english_stem<> m_stemmer;
 };
 
 #endif // ENGLISHPLUGIN_H
index 29f4074..404c425 100644 (file)
@@ -22,6 +22,8 @@ HEADERS += \
 RESOURCES += \
        english.qrc
 
+INCLUDEPATH += $$PWD/../../third-party/include
+
 win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../../utility/release/ -lutility
 else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../../utility/debug/ -lutility
 else:unix: LIBS += -L$$OUT_PWD/../../utility/ -lutility
index 43576be..9b4d25a 100644 (file)
@@ -69,6 +69,8 @@ public:
         * \brief 引数として与えられた文字列を正規化して返します。
         */
        virtual QString normalize(QString string) = 0;
+
+       virtual QString stem(QString string) { return string; }
 };
 
 Q_DECLARE_INTERFACE(Language, "net.wordring.tm.language/1.0")
index 0cf57ce..95b084e 100644 (file)
@@ -4,3 +4,4 @@ SUBDIRS += \
        language \
        english \
        japanese \
+    dutch
index 052a657..69af980 100644 (file)
@@ -24,6 +24,8 @@
 
 #include "debug.h"
 
+#define TM_VERSION 1
+
 int main(int argc, char *argv[])
 {
        //SetDebugMemoryLeaks();
@@ -38,6 +40,13 @@ int main(int argc, char *argv[])
        Settings settings(path, QSettings::IniFormat);
        QString app_path = QCoreApplication::applicationDirPath();
 
+       // 設定ファイルのバージョンと違う場合、必要に応じてファイルや設定を消去する。
+       if(settings.value("Main/version", 0) != TM_VERSION)
+       {
+               //qDebug() << settings.;
+       }
+
+
        // Language
 #ifdef QT_DEBUG
        settings.setValue(
@@ -51,6 +60,7 @@ int main(int argc, char *argv[])
                settings.setValue("Japanese/mecabdic", mecabdic);
        }
 #endif
+
        // HttpServer
        if(!settings.contains("HttpServer/port")) settings.setValue("HttpServer/port", 8080);
        // SocketServer
diff --git a/proxy/tm.js b/proxy/tm.js
deleted file mode 100644 (file)
index 20ba3d6..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-
-window.wordring = {
-       socket: null, // TMとの通信用ソケット。
-       port: 1, // ソケットのポート番号。
-       url: '',
-       edit_mode: false, // 編集モード判別フラグ。
-       slanguage: '',
-       tlanguage: '',
-       
-       segments: null, // パラグラフの連想配列。
-       
-       // ページのセットアップを行う。
-       setup: function() {
-               if(!window.WebSocket) alert('Your browser does not support websocket.\r\nBecause wordring-tm needs it, you must use the latest browser.');
-               // 原文のコピーを取る。
-               wordring.segments = Array();
-               var elements = document.getElementsByTagName('span');
-               var element;
-               var i = 0;
-               for(; i < elements.length ; i++)
-               {
-                       element = elements.item(i);
-                       if(!element.hasAttribute('data-wordring-segment')) continue;
-                       
-                       var id = element.getAttribute('data-wordring-segment');
-                       var segment = {};
-                       segment.segment_id = id;
-                       segment.loaded = false;
-                       segment.element = element;
-                       segment.html = element.innerHTML;
-                       wordring.segments[id] = segment;
-               }
-               
-               wordring.socket = new WebSocket('ws://localhost:' + window.wordring.port + '/');
-               wordring.socket.onopen = wordring.onopen;
-               wordring.socket.onmessage = wordring.onmessage;
-               wordring.socket.onerror = wordring.onerror;
-               wordring.socket.onclose = wordring.onclose;
-       },
-       
-       onopen: function(ev) {
-               document.addEventListener('click', wordring.onclick);
-               window.addEventListener('focus', wordring.onfocus);
-               window.addEventListener('blur', wordring.onblur);
-               
-               wordring.socket.send(JSON.stringify({
-                       'cmd': 'load',
-                       'url': window.wordring.url
-               }));
-               
-               // 全てのセグメントの対して、セグメントの情報を送信する。
-               var length = wordring.segments.length;
-               var i = 0;
-               for(; i < length; i++) {
-                       var segment = wordring.segments[i];
-                       wordring.socket.send(JSON.stringify({
-                               'cmd': 'load_segment',
-                               'segment_id': segment.segment_id,
-                               'html': segment.html
-                       }));
-               }
-       },
-       
-       onmessage: function(ev) {
-               var json = JSON.parse(ev.data);
-               switch(json.cmd)
-               {
-               case 'set_segment': wordring.set_segment(json); break;
-               case 'set_edit_mode': wordring.set_edit_mode(json); break;
-               case 'segment_loaded': wordring.segment_loaded(json); break;
-               }
-       },
-       
-       onerror: function(ev) {
-               //document.location.href = 'http://www.yahoo.co.jp/';
-       },
-       
-       onclose: function(ev) {
-               // alert('接続が閉じられました');
-       },
-       
-       onfocus: function(ev) {
-               wordring.socket.send(JSON.stringify({
-                       'cmd': 'focus'
-               }));
-       },
-       
-       onblur: function(e) {
-               wordring.socket.send(JSON.stringify({
-                       'cmd': 'blur'
-               }));
-
-       },
-       
-       onclick: function(ev) {
-               if(!wordring.edit_mode) return;
-               ev.preventDefault();
-               var node;
-               for(node = ev.target; node.nodeType == Node.ELEMENT_NODE; node = node.parentNode) {
-                       if(node.hasAttribute('data-wordring-segment'))
-                       {
-                               var id = node.getAttribute('data-wordring-segment');
-                               var segment = wordring.segments[id];
-                               if(segment.loaded) break;
-                               wordring.socket.send(JSON.stringify({
-                                       'cmd': 'edit_segment',
-                                       'segment_id': segment.segment_id
-                               }));
-                               break;
-                       }
-               }
-       },
-       
-       set_segment: function(json) {
-               var segment_id = json.segment_id;
-               wordring.segments[segment_id].element.innerHTML = json.html;
-       },
-       
-       set_edit_mode: function(json) {
-               wordring.edit_mode = json.edit_mode;
-       },
-       
-       segment_loaded: function(json) {
-               var segment_id = json.segment_id;
-               var segment = wordring.segments[segment_id];
-               segment.loaded = true;
-               segment.element.className = '';
-       }
-};
-
-if(document.addEventListener)
-{
-       window.addEventListener('load', function(ev){ 
-               wordring.setup();
-       });     
-} else {
-       window.attachEvent('onload', function(ev){ 
-               wordring.setup();
-       });
-}
-
-
index 75f7846..09b951b 100644 (file)
@@ -729,6 +729,8 @@ void TM::Database::insert_sentence(
        quint32 target_id = target_sentence->sentence_id;
        assert(target_id); // 挿入あるいは更新しているので、IDがある。
 
+
+       // 単語とセンテンスの索引を付ける。
        // 単語の登録。
        IndexDatabase::pointer index_database =
                        find_index_database(site_id, scode, tcode);
@@ -837,7 +839,7 @@ TM::IndexDatabase::pointer TM::Database::find_index_database(
 
        // データベース名を作成する。
        QString dbname, sname, tname, site_name;
-       sname = find_language_name(scode).toLower();
+       sname = QLocale::languageToString(static_cast<QLocale::Language>(scode));
        assert(!sname.isEmpty());
        if(!sname.isEmpty())
        {
index 7b79400..b0cce9b 100644 (file)
@@ -2,6 +2,7 @@
 #define TMDATABASE_H
 
 #include "tmsocket.h"
+#include "tmtext.h"
 
 #include <QObject>
 #include <QPointer>
@@ -108,8 +109,6 @@ class SentenceDatabase : public DatabaseBase
 {
 public:
        typedef std::shared_ptr<SentenceDatabase> pointer;
-
-
        typedef QList<sentence_data_type> sentences_data_type;
 
 private:
@@ -217,15 +216,16 @@ public slots:
        void remove_sentence(QString site_name, quint32 scode, quint32 tcode,
                                                sentence_data_type::pointer source);
 
+       //void insert_index();
+
 private:
        QString find_language_name(int code) const;
 
        int find_word_id(int code, QString word);
        WordDatabase::pointer find_word_database(int code);
-       IndexDatabase::pointer find_index_database(
-                       quint32 site_id, int scode, int tcode);
 
-       void insert_word_sentence_index(quint32 site_id, int scode, int tcode);
+       IndexDatabase::pointer find_index_database(
+                                                                       quint32 site_id, int scode, int tcode);
 
        SentenceDatabase::pointer find_sentence_database(quint32 site_id, int code);
 
index 4ae065c..1f5adc3 100644 (file)
@@ -25,6 +25,7 @@
 #include <QBrush>
 #include <QFont>
 #include <QMimeData>
+#include <QLocale>
 
 #include <QList>
 
@@ -44,7 +45,7 @@ TM::EditorWidget::EditorWidget(Settings *settings, Service *service, QWidget *pa
        vlayout->setSpacing(4);
        vlayout->setContentsMargins(0, 0, 0, 0);
 
-       m_toolbar = new QToolBar("Editor", this);
+       m_toolbar = new QToolBar("editor", this);
 
        m_edit_mode = new QAction(QIcon(":/edit.png"), "edit", this);
        m_edit_mode->setCheckable(true);
@@ -57,11 +58,11 @@ TM::EditorWidget::EditorWidget(Settings *settings, Service *service, QWidget *pa
        m_toolbar->addAction(m_link);
        connect(m_link, SIGNAL(triggered(bool)), this, SLOT(onLinkModeTriggered(bool)));
 
-       m_slang = new QAction("&Source", this);
-       m_slang->setDisabled(true);
+       m_slang = new QAction("&source", this);
+       //m_slang->setDisabled(true);
        m_slang->setMenu(new QMenu(this));
-       m_tlang = new QAction("&Target", this);
-       m_tlang->setDisabled(true);
+       m_tlang = new QAction("&target", this);
+       //m_tlang->setDisabled(true);
        m_tlang->setMenu(new QMenu(this));
        m_toolbar->addAction(m_slang);
        m_toolbar->addAction(m_tlang);
@@ -224,14 +225,19 @@ void TM::EditorWidget::remove_sentence(int segment_id, int index)
  */
 void TM::EditorWidget::onLanguageLoaded(int code, QString name, QIcon icon)
 {
-       QString dslanguage = m_settings->value("Widget/defaultSourceLanguage", "English").toString();
-       QString tslanguage = m_settings->value("Widget/defaultSourceLanguage", "Japanese").toString();
-       if(dslanguage == name)
+       if(!m_settings->contains("Widget/default_source_language"))
+                       m_settings->setValue("Widget/default_source_language", QLocale::Language::English);
+       if(!m_settings->contains("Widget/default_target_language"))
+                       m_settings->setValue("Widget/default_target_language", QLocale::Language::Japanese);
+
+       int scode = m_settings->value("Widget/default_source_language").toInt();
+       int tcode = m_settings->value("Widget/default_target_language").toInt();
+       if(code == scode)
        {
                m_slang->setIcon(icon);
                m_slang->setData(code);
        }
-       if(tslanguage == name)
+       if(code == tcode)
        {
                m_tlang->setIcon(icon);
                m_tlang->setData(code);
@@ -252,8 +258,8 @@ void TM::EditorWidget::onEditModeTriggered(bool)
        QAction *edit_mode = qobject_cast<QAction*>(sender());
        bool checked = edit_mode->isChecked();
        m_link->setDisabled(true);
-       m_slang->setDisabled(!checked);
-       m_tlang->setDisabled(!checked);
+       //m_slang->setDisabled(!checked);
+       //m_tlang->setDisabled(!checked);
        emit editModeChanged(checked);
 
        m_edit->set_edit_mode(checked);
@@ -278,6 +284,8 @@ void TM::EditorWidget::onSourceLanguageTriggered(bool)
        m_slang->setIcon(saction->icon());
        m_slang->setData(saction->data());
 
+       m_settings->setValue("Widget/default_source_language", saction->data());
+
        emit sourceLanguageChanged();
 }
 
@@ -291,6 +299,8 @@ void TM::EditorWidget::onTargetLanguageTriggered(bool)
        m_tlang->setIcon(taction->icon());
        m_tlang->setData(taction->data());
 
+       m_settings->setValue("Widget/default_target_language", taction->data());
+
        emit targetLanguageChanged();
 }
 
index 1f8394f..956ae76 100644 (file)
@@ -12,6 +12,7 @@
 #include <QJsonArray>
 #include <QMap>
 #include <QQueue>
+#include <QAbstractSocket>
 
 #include <QIcon>
 
index 2143ea7..eee02eb 100644 (file)
@@ -4,7 +4,7 @@
 
 #include "settings.h"
 #include "html.h"
-#include "htmltag.h"
+#include "tmtext.h"
 
 #include <QMutex>
 #include <QMutexLocker>
@@ -42,304 +42,6 @@ TM::HtmlData::pointer TM::HtmlData::create(HtmlNode node_, int begin_, int tail_
        return pointer(new HtmlData(node_, begin_, tail_));
 }
 
-// TextConverter --------------------------------------------------------------
-
-/*!
- * \brief 引数として与えられたHtmlの範囲から構造化テキストを作成します。
- */
-Text::pointer TM::TextConverter::to_text(HtmlRange range)
-{
-       m_state = 0;
-       Text::pointer result = Text::create();
-       int begin = 0;
-
-       for(HtmlNode const &node : range)
-       {
-               if(node.type() != HtmlNode::Text) continue;
-               Text::pointer p = stuff_text(result, node.value());
-               if(!p) continue;
-               int num = p->string().size();
-               HtmlData::pointer hd = HtmlData::create(node, begin, begin + num - 1);
-               p->set_data(hd);
-               begin += num;
-       }
-       return result;
-}
-
-/*!
- * \brief 引数として与えられたノードから構造化テキストを作成します。
- *
- * 連続する空白文字を一つにまとめます。
- * 無効なノードが与えられた場合、空の構造化テキストを返します。
- */
-Text::pointer TM::TextConverter::stuff_text(Text::pointer parent, QString const &string)
-{
-       QString outstring;
-       for(QChar const &ch : string)
-       {
-               if(is_ignorable_white_space(ch)) continue;
-               if(is_white_space(ch)) outstring.append(' ');
-               else outstring.append(ch);
-       }
-       if(outstring.isEmpty()) return Text::pointer();
-
-       Text::pointer result = Text::create(parent, outstring);
-       parent->append(result);
-       return result;
-}
-
-/*!
- * \brief 連続する空白文字を検出します。
- *
- * 最初の空白文字、あるいは空白文字以外は、falseを返します。
- * 連続する空白文字の二番目以降に対してのみtrueを返します。
- */
-bool TM::TextConverter::is_ignorable_white_space(const QChar &ch)
-{
-       if(!is_white_space(ch))
-       {
-               m_state = 0;
-               return false;
-       }
-       if(m_state == 0)
-       {
-               m_state = 1;
-               return false;
-       }
-       return true;
-}
-
-/*!
- * \brief 引数として与えられたchが空白文字の場合true、それ以外の場合falseを返します。
- */
-bool TM::TextConverter::is_white_space(QChar const &ch)
-{
-       switch(ch.unicode())
-       {
-       case 0x9:
-       case 0xA:
-       case 0xC:
-       case 0xD:
-       case 0x20:
-       case 0x200B:
-               return true;
-       }
-       return false;
-}
-
-// HtmlConverter --------------------------------------------------------------
-
-
-void TM::HtmlConverter::append(QString string)
-{
-       HtmlText::pointer text = HtmlText::create(HtmlText::weak_pointer());
-       text->set_value(string);
-       m_nodes.append(text);
-}
-
-void TM::HtmlConverter::append(HtmlNode::pointer node, QString string)
-{
-       QList<HtmlNode::pointer> left, right;
-       for(HtmlNode hn = node->parent(); hn; hn = hn.parent())
-       {
-               if(hn.tname() == "body") break;
-               left.prepend(hn.lself());
-               right.append(hn.ltail());
-       }
-
-       m_nodes.append(left);
-       append(string);
-       m_nodes.append(right);
-}
-
-QString TM::HtmlConverter::to_string()
-{
-       QString result;
-
-       adjust();
-       for(Html::pointer node : m_nodes) result += node->to_string();
-
-       return result;
-}
-
-void TM::HtmlConverter::adjust()
-{
-       int adjusted = 0;
-       do
-       {
-               adjusted = 0;
-               for(int i = 0; i < m_nodes.size() - 1; i++)
-               {
-                       HtmlNode::pointer p1 = m_nodes.at(i);
-                       if(p1->type() != Html::Element || p1->place() != Html::Close) continue;
-                       HtmlNode::pointer p2 = m_nodes.at(i + 1);
-                       if(p2->type() != Html::Element || p2->place() != Html::Open) continue;
-
-                       if(p1->lbegin() == p2->lbegin())
-                       {
-                               m_nodes.removeAt(i);
-                               m_nodes.removeAt(i);
-                               ++adjusted;
-                       }
-               }
-       }
-       while(adjusted);
-}
-
-// TextSegment ----------------------------------------------------------------
-
-TM::TextSegment::TextSegment(
-               Service *service, int scode, int segment_id, QString source)
-       : m_segment_id(segment_id)
-       , m_document(source.toUtf8())
-{
-       HtmlNode body = m_document.first("html").first("body");
-       TextConverter tc;
-       m_text = tc.to_text(HtmlRange(body, body));
-
-       Text::pointer sentences = service->divide_into_sentences(scode, m_text->to_string());
-       int i = 0;
-       int previous_crc = 0;
-       for(Text::pointer s = sentences->begin(); s; s = s->next()) // s: sentence
-       {
-               Text::pointer words = service->divide_into_words(scode, s);
-               int crc = service->crc32(scode, words->to_string());
-               TextSentence::pointer sentence =
-                               TextSentence::create(segment_id, i++, crc, words);
-               sentence->set_previous_crc(previous_crc);
-               m_sentences.append(sentence);
-               previous_crc = crc;
-       }
-
-       int next_crc = 0;
-       for(int i = m_sentences.size() - 1; 0 <= i; i--)
-       {
-               TextSentence::pointer sentence = m_sentences.at(i);
-               sentence->set_next_crc(next_crc);
-               next_crc = sentence->crc();
-       }
-}
-
-int TM::TextSegment::segment_id() const { return m_segment_id; }
-
-int TM::TextSegment::size() const { return m_sentences.size(); }
-
-TM::TextSentence::pointer TM::TextSegment::at(int index)
-{
-       assert(0 <= index && index < m_sentences.size());
-       return m_sentences.at(index);
-}
-
-TM::TextSegment::iterator TM::TextSegment::begin() { return m_sentences.begin(); }
-
-TM::TextSegment::iterator TM::TextSegment::end() { return m_sentences.end(); }
-
-HtmlNode::pointer TM::TextSegment::find_html_node_by_offset(int offset)
-{
-       HtmlNode::pointer result;
-
-       for(Text::pointer p = m_text->begin(); p; p = p->next())
-       {
-               UserData::pointer ud = p->data();
-               assert(ud->type() == HtmlData::Type);
-               HtmlData *hd = static_cast<HtmlData*>(ud.get());
-               if(hd->begin() <= offset && offset <= hd->tail())
-               {
-                       result = hd->node().lself();
-                       break;
-               }
-       }
-       return result;
-}
-
-/*!
- * \brief セグメント全体をHTML文字列に変換します。
- */
-QString TM::TextSegment::to_html()
-{
-       QString result;
-       for(TextSentence::pointer sentence : m_sentences)
-       {
-               if(!sentence->target_sentence())
-                       result += to_html_from_source(sentence);
-               else result += to_html_from_target(sentence);
-               result += "\r\n";
-       }
-       return result;
-}
-
-/*!
- * \brief 原文をHTMLに変換します。
- *
- * 訳文のついていない文のために在ります。
- */
-QString TM::TextSegment::to_html_from_source(TextSentence::pointer sentence)
-{
-       HtmlConverter hc;
-
-       UserData *ud = sentence->source_sentence()->data().get();
-       assert(ud->type() == RangeData::Type);
-       RangeData *rd = static_cast<RangeData*>(ud);
-       int sentence_offset = rd->begin();
-
-       Text::pointer source_sentence = sentence->source_sentence();
-       if(!source_sentence) return "";
-
-       for(Text::pointer word = source_sentence->begin(); word; word = word->next())
-       {
-               QString string = word->to_string();
-               UserData *ud = word->data().get();
-               assert(ud->type() == RangeData::Type);
-               RangeData *rd = static_cast<RangeData*>(ud);
-               int word_offset = sentence_offset + rd->begin();
-               HtmlNode::pointer node = find_html_node_by_offset(word_offset);
-               if(node) hc.append(node, string);
-               else hc.append(string);
-       }
-       return hc.to_string();
-}
-
-/*!
- * \brief 訳文をHTMLに変換します。
- */
-QString TM::TextSegment::to_html_from_target(TextSentence::pointer sentence)
-{
-       HtmlConverter hc;
-
-       WordLinker* linker = sentence->linker();
-       UserData *ud = sentence->source_sentence()->data().get();
-       assert(ud->type() == RangeData::Type);
-       RangeData *rd = static_cast<RangeData*>(ud);
-       int sentence_offset = rd->begin();
-
-       Text::pointer target_sentence = sentence->target_sentence();
-       if(!target_sentence) return "";
-
-       for(Text::pointer word = target_sentence->begin(); word; word = word->next())
-       {
-               QString string = word->to_string();
-               WordLink::pointer link = linker->find(WordLink::Target, word);
-               if(!link) hc.append(string);
-               else
-               {
-                       UserData::pointer ud = link->sources()->at(0)->data();
-                       assert(ud->type() == RangeData::Type);
-                       RangeData *rd = static_cast<RangeData*>(ud.get());
-                       int word_offset = sentence_offset + rd->begin();
-                       HtmlNode::pointer node = find_html_node_by_offset(word_offset);
-                       if(node) hc.append(node, string);
-                       else hc.append(string);
-               }
-       }
-       return hc.to_string();
-}
-
-TM::TextSegment::pointer TM::TextSegment::create(
-               Service *service, int scode, int segment_id, QString source)
-{
-       return pointer(new TextSegment(service, scode, segment_id, source));
-}
-
 // SocketConnection -----------------------------------------------------------
 
 TM::SocketConnection::SocketConnection(Settings *settings, Service *service,
@@ -351,7 +53,7 @@ TM::SocketConnection::SocketConnection(Settings *settings, Service *service,
        , m_editor_widget(editor_widget)
        , m_site_id(0)
        , m_edit_mode(false)
-       , m_source_language_code(0)
+       , m_scode(0)
        , m_target_language_code(0)
 {
        qRegisterMetaType<pointer>();
@@ -390,6 +92,8 @@ void TM::SocketConnection::send_message(QJsonObject const &json)
  * \brief データベースへセンテンスの登録とブラウザへの反映を行います。
  * \param segment_id セグメントのID。
  * \param index センテンスのインデックス。
+ *
+ * エディタから呼び出されます。
  */
 void TM::SocketConnection::save_sentence(int segment_id, int index)
 {
@@ -548,6 +252,7 @@ void TM::SocketConnection::set_segment(int segment_id, QString html)
 void TM::SocketConnection::do_edit_segment(QJsonObject const &json)
 {
        assert(json.contains("segment_id"));
+       if(!json.contains("segment_id")) return;
        int segment_id = json["segment_id"].toString().toInt();
 
        segment_map_iterator it = m_segments.find(segment_id);
@@ -584,7 +289,7 @@ void TM::SocketConnection::do_load(QJsonObject const &json)
 
        set_edit_mode(m_editor_widget->edit_mode());
 
-       m_source_language_code = m_editor_widget->source_language();
+       m_scode = m_editor_widget->source_language();
        m_target_language_code = m_editor_widget->target_language();
        m_url = QUrl(json["url"].toString());
        m_site_id = m_service->find_site_id(m_url.host());
@@ -607,7 +312,7 @@ void TM::SocketConnection::do_load_segment(QJsonObject const &json)
 
        // セグメントの挿入。
        TextSegment::pointer segment = TextSegment::create(
-               m_service, m_source_language_code, segment_id, html);
+               m_service, m_scode, segment_id, html);
        m_segments.insert(segment_id, segment);
 
        // センテンス完全一致訳文の検索。
@@ -615,7 +320,7 @@ void TM::SocketConnection::do_load_segment(QJsonObject const &json)
        {
                m_service->find_sentence(
                                segment_id, sentence->index(),
-                               m_url.host(), m_source_language_code, m_target_language_code,
+                               m_url.host(), m_scode, m_target_language_code,
                                sentence, pointer(this));
        }
 }
index a190340..87839e1 100644 (file)
@@ -31,94 +31,6 @@ namespace TM
 class Service;
 class EditorWidget;
 
-class HtmlData : public RangeData
-{
-public:
-       typedef std::shared_ptr<HtmlData> pointer;
-
-       enum : int { Type = UserData::User + 1, };
-
-private:
-       HtmlData(HtmlNode node_, int begin_, int tail_);
-
-public:
-       int type() const;
-       HtmlNode node();
-
-       QString debug_dump() const;
-
-       static pointer create(HtmlNode node_, int begin_, int tail_);
-
-private:
-       HtmlNode m_node;
-};
-
-/*!
- * \brief HtmlRangeから構造化テキストに変換するためのクラスです。
- */
-class TextConverter
-{
-public:
-       Text::pointer to_text(HtmlRange range);
-       Text::pointer stuff_text(Text::pointer parent, QString const &string);
-
-       bool is_ignorable_white_space(QChar const &ch);
-
-       static bool is_white_space(QChar const &ch);
-
-private:
-       int m_state;
-};
-
-class HtmlConverter
-{
-public:
-       void append(QString string);
-       void append(HtmlNode::pointer node, QString string);
-       QString to_string();
-
-private:
-       void adjust();
-
-private:
-       QList<HtmlNode::pointer> m_nodes;
-};
-
-class TextSegment
-{
-public:
-       typedef std::shared_ptr<TextSegment> pointer;
-       typedef QList<TextSentence::pointer> storage_type;
-       typedef storage_type::iterator iterator;
-
-private:
-       TextSegment(Service *service, int scode, int segment_id, QString source);
-public:
-
-       int segment_id() const;
-
-       int size() const;
-       TextSentence::pointer at(int index);
-       iterator begin();
-       iterator end();
-
-       QString to_html();
-       QString to_html_from_source(TextSentence::pointer sentence);
-       QString to_html_from_target(TextSentence::pointer sentence);
-
-       HtmlNode::pointer find_html_node_by_offset(int offset);
-
-       static pointer create(
-                       Service *service, int scode, int segment_id, QString source);
-
-private:
-       int m_segment_id; /*!< data-wordring-segmentの値によるセグメントのID。 */
-       HtmlDocument m_document; /*!< セグメントのHtmlDocument。 */
-       Text::pointer m_text; /*!< セグメントのHtmlData付テキスト。 */
-
-       storage_type m_sentences; /*!< 編集用センテンスのリスト。 */
-};
-
 class SocketConnection : public QObject
 {
        Q_OBJECT
@@ -148,7 +60,7 @@ public:
                                                        quint32 source_id, quint32 target_id);
 
 signals:
-       void editCmd(int id, QString html);
+       //void editCmd(int id, QString html);
 
 public slots:
        void changeEditMode(bool edit_mode);
@@ -180,7 +92,7 @@ private:
        int m_site_id;
 
        bool m_edit_mode;
-       int m_source_language_code;
+       int m_scode;
        int m_target_language_code;
 
        EditorWidget *m_editor_widget;
index 9578f3f..09ad48e 100644 (file)
-#include "tmtext.h"
+#include "html.h"
+#include "htmltag.h"
+#include "tmtext.h"
+#include "tmservice.h"
 
 #include <QJsonDocument>
-#include <QJsonDocument>
 
 #include "debug.h"
 
+namespace TM
+{
+
+/*!
+ * \brief TextSegment内で使われるHtml文字列を作るためのヘルパークラスです。
+ */
+class HtmlConverter
+{
+public:
+       void append(QString string);
+       void append(HtmlNode::pointer node, QString string);
+       QString to_string();
+
+private:
+       void adjust();
+
+private:
+       QList<HtmlNode::pointer> m_nodes;
+};
+
+/*!
+ * \brief TextSegmentから使われるHtmlRangeから構造化テキストに変換するためのクラスです。
+ */
+class TextConverter
+{
+public:
+       Text::pointer to_text(HtmlRange range);
+       Text::pointer stuff_text(Text::pointer parent, QString const &string);
+
+       bool is_ignorable_white_space(QChar const &ch);
+
+       static bool is_white_space(QChar const &ch);
+
+private:
+       int m_state;
+};
+
+} // namespace TM
+
+// HtmlConverter --------------------------------------------------------------
+
+void TM::HtmlConverter::append(QString string)
+{
+       HtmlText::pointer text = HtmlText::create(HtmlText::weak_pointer());
+       text->set_value(string);
+       m_nodes.append(text);
+}
+
+void TM::HtmlConverter::append(HtmlNode::pointer node, QString string)
+{
+       QList<HtmlNode::pointer> left, right;
+       for(HtmlNode hn = node->parent(); hn; hn = hn.parent())
+       {
+               if(hn.tname() == "body") break;
+               left.prepend(hn.lself());
+               right.append(hn.ltail());
+       }
+
+       m_nodes.append(left);
+       append(string);
+       m_nodes.append(right);
+}
+
+QString TM::HtmlConverter::to_string()
+{
+       QString result;
+
+       adjust();
+       for(Html::pointer node : m_nodes) result += node->to_string();
+
+       return result;
+}
+
+void TM::HtmlConverter::adjust()
+{
+       int adjusted = 0;
+       do
+       {
+               adjusted = 0;
+               for(int i = 0; i < m_nodes.size() - 1; i++)
+               {
+                       HtmlNode::pointer p1 = m_nodes.at(i);
+                       if(p1->type() != Html::Element || p1->place() != Html::Close) continue;
+                       HtmlNode::pointer p2 = m_nodes.at(i + 1);
+                       if(p2->type() != Html::Element || p2->place() != Html::Open) continue;
+
+                       if(p1->lbegin() == p2->lbegin())
+                       {
+                               m_nodes.removeAt(i);
+                               m_nodes.removeAt(i);
+                               ++adjusted;
+                       }
+               }
+       }
+       while(adjusted);
+}
+
+// TextConverter --------------------------------------------------------------
+
+/*!
+ * \brief 引数として与えられたHtmlの範囲から構造化テキストを作成します。
+ */
+Text::pointer TM::TextConverter::to_text(HtmlRange range)
+{
+       m_state = 0;
+       Text::pointer result = Text::create();
+       int begin = 0;
+
+       for(HtmlNode const &node : range)
+       {
+               if(node.type() != HtmlNode::Text) continue;
+               Text::pointer p = stuff_text(result, node.value());
+               if(!p) continue;
+               int num = p->string().size();
+               HtmlData::pointer hd = HtmlData::create(node, begin, begin + num - 1);
+               p->set_data(hd);
+               begin += num;
+       }
+       return result;
+}
+
+/*!
+ * \brief 引数として与えられたノードから構造化テキストを作成します。
+ *
+ * 連続する空白文字を一つにまとめます。
+ * 無効なノードが与えられた場合、空の構造化テキストを返します。
+ */
+Text::pointer TM::TextConverter::stuff_text(Text::pointer parent, QString const &string)
+{
+       QString outstring;
+       for(QChar const &ch : string)
+       {
+               if(is_ignorable_white_space(ch)) continue;
+               if(is_white_space(ch)) outstring.append(' ');
+               else outstring.append(ch);
+       }
+       if(outstring.isEmpty()) return Text::pointer();
+
+       Text::pointer result = Text::create(parent, outstring);
+       parent->append(result);
+       return result;
+}
+
+/*!
+ * \brief 連続する空白文字を検出します。
+ *
+ * 最初の空白文字、あるいは空白文字以外は、falseを返します。
+ * 連続する空白文字の二番目以降に対してのみtrueを返します。
+ */
+bool TM::TextConverter::is_ignorable_white_space(const QChar &ch)
+{
+       if(!is_white_space(ch))
+       {
+               m_state = 0;
+               return false;
+       }
+       if(m_state == 0)
+       {
+               m_state = 1;
+               return false;
+       }
+       return true;
+}
+
+/*!
+ * \brief 引数として与えられたchが空白文字の場合true、それ以外の場合falseを返します。
+ */
+bool TM::TextConverter::is_white_space(QChar const &ch)
+{
+       switch(ch.unicode())
+       {
+       case 0x9:
+       case 0xA:
+       case 0xC:
+       case 0xD:
+       case 0x20:
+       case 0x200B:
+               return true;
+       }
+       return false;
+}
+
 // sentence_data_type ---------------------------------------------------------
 
 TM::sentence_data_type::sentence_data_type()
@@ -279,9 +463,6 @@ TM::TextSentence::TextSentence(int segment_id, int index, quint32 crc, Text::poi
        , m_previous_crc(0)
        , m_next_crc(0)
        , m_source_id(0)
-
-
-       , m_loaded(false)
 {
 }
 
@@ -504,13 +685,6 @@ QList<TM::sentence_data_type::const_pointer> const& TM::TextSentence::candidates
        return m_candidates;
 }
 
-bool TM::TextSentence::is_loaded() const { return m_loaded; }
-
-void TM::TextSentence::set_loaded(bool loaded)
-{
-       m_loaded = loaded;
-}
-
 QString TM::TextSentence::debug_dump() const
 {
        QString result;
@@ -539,13 +713,177 @@ TM::TextSentence::pointer TM::TextSentence::create(
        return pointer(new TextSentence(segment_id, index, crc, source_sentence));
 }
 
+// TextSegment ----------------------------------------------------------------
+
+TM::TextSegment::TextSegment(
+               Service *service, int scode, int segment_id, QString source)
+       : m_segment_id(segment_id)
+       , m_document(source.toUtf8())
+{
+       HtmlNode body = m_document.first("html").first("body");
+       TextConverter tc;
+       m_text = tc.to_text(HtmlRange(body, body));
+
+       Text::pointer sentences = service->divide_into_sentences(scode, m_text->to_string());
+       int i = 0;
+       int previous_crc = 0;
+       for(Text::pointer s = sentences->begin(); s; s = s->next()) // s: sentence
+       {
+               Text::pointer words = service->divide_into_words(scode, s);
+               int crc = service->crc32(scode, words->to_string());
+               TextSentence::pointer sentence =
+                               TextSentence::create(segment_id, i++, crc, words);
+               sentence->set_previous_crc(previous_crc);
+               m_sentences.append(sentence);
+               previous_crc = crc;
+       }
+
+       int next_crc = 0;
+       for(int i = m_sentences.size() - 1; 0 <= i; i--)
+       {
+               TextSentence::pointer sentence = m_sentences.at(i);
+               sentence->set_next_crc(next_crc);
+               next_crc = sentence->crc();
+       }
+}
+
+int TM::TextSegment::segment_id() const { return m_segment_id; }
+
+int TM::TextSegment::size() const { return m_sentences.size(); }
+
+TM::TextSentence::pointer TM::TextSegment::at(int index)
+{
+       assert(0 <= index && index < m_sentences.size());
+       return m_sentences.at(index);
+}
+
+TM::TextSegment::iterator TM::TextSegment::begin() { return m_sentences.begin(); }
+
+TM::TextSegment::iterator TM::TextSegment::end() { return m_sentences.end(); }
+
+HtmlNode::pointer TM::TextSegment::find_html_node_by_offset(int offset)
+{
+       HtmlNode::pointer result;
+
+       for(Text::pointer p = m_text->begin(); p; p = p->next())
+       {
+               UserData::pointer ud = p->data();
+               assert(ud->type() == HtmlData::Type);
+               HtmlData *hd = static_cast<HtmlData*>(ud.get());
+               if(hd->begin() <= offset && offset <= hd->tail())
+               {
+                       result = hd->node().lself();
+                       break;
+               }
+       }
+       return result;
+}
+
+/*!
+ * \brief セグメント全体をHTML文字列に変換します。
+ */
+QString TM::TextSegment::to_html()
+{
+       QString result;
+       for(TextSentence::pointer sentence : m_sentences)
+       {
+               if(!sentence->target_sentence())
+                       result += to_html_from_source(sentence);
+               else result += to_html_from_target(sentence);
+               result += "\r\n";
+       }
+       return result;
+}
+
+/*!
+ * \brief 原文をHTMLに変換します。
+ *
+ * 訳文のついていない文のために在ります。
+ */
+QString TM::TextSegment::to_html_from_source(TextSentence::pointer sentence)
+{
+       HtmlConverter hc;
+
+       UserData *ud = sentence->source_sentence()->data().get();
+       assert(ud->type() == RangeData::Type);
+       RangeData *rd = static_cast<RangeData*>(ud);
+       int sentence_offset = rd->begin();
+
+       Text::pointer source_sentence = sentence->source_sentence();
+       if(!source_sentence) return "";
+
+       for(Text::pointer word = source_sentence->begin(); word; word = word->next())
+       {
+               QString string = word->to_string();
+               UserData *ud = word->data().get();
+               assert(ud->type() == RangeData::Type);
+               RangeData *rd = static_cast<RangeData*>(ud);
+               int word_offset = sentence_offset + rd->begin();
+               HtmlNode::pointer node = find_html_node_by_offset(word_offset);
+               if(node) hc.append(node, string);
+               else hc.append(string);
+       }
+       return hc.to_string();
+}
+
+/*!
+ * \brief 訳文をHTMLに変換します。
+ */
+QString TM::TextSegment::to_html_from_target(TextSentence::pointer sentence)
+{
+       HtmlConverter hc;
 
+       WordLinker* linker = sentence->linker();
+       UserData *ud = sentence->source_sentence()->data().get();
+       assert(ud->type() == RangeData::Type);
+       RangeData *rd = static_cast<RangeData*>(ud);
+       int sentence_offset = rd->begin();
 
+       Text::pointer target_sentence = sentence->target_sentence();
+       if(!target_sentence) return "";
 
+       for(Text::pointer word = target_sentence->begin(); word; word = word->next())
+       {
+               QString string = word->to_string();
+               WordLink::pointer link = linker->find(WordLink::Target, word);
+               if(!link) hc.append(string);
+               else
+               {
+                       UserData::pointer ud = link->sources()->at(0)->data();
+                       assert(ud->type() == RangeData::Type);
+                       RangeData *rd = static_cast<RangeData*>(ud.get());
+                       int word_offset = sentence_offset + rd->begin();
+                       HtmlNode::pointer node = find_html_node_by_offset(word_offset);
+                       if(node) hc.append(node, string);
+                       else hc.append(string);
+               }
+       }
+       return hc.to_string();
+}
 
+TM::TextSegment::pointer TM::TextSegment::create(
+               Service *service, int scode, int segment_id, QString source)
+{
+       return pointer(new TextSegment(service, scode, segment_id, source));
+}
 
+// TextSegmentList ------------------------------------------------------------
 
+TM::TextSegmentList::TextSegmentList(Service *service)
+       : m_service(service)
+{
+}
 
+TM::TextSegment::pointer TM::TextSegmentList::at(int segment_id)
+{
+       return m_segments.at(segment_id);
+}
+
+TM::TextSegment::pointer TM::TextSegmentList::append(int scode, QString html_source)
+{
+       //TextSegment::create(m_service, )
+       return TextSegment::pointer();
+}
 
 
 
index 5cad1b8..86fa38e 100644 (file)
@@ -2,9 +2,11 @@
 #define TMTEXT_H
 
 #include "text.h"
+#include "html.h"
 
 #include <QString>
 #include <QList>
+#include <QMap>
 
 #include <QJsonDocument>
 #include <QJsonObject>
@@ -15,6 +17,8 @@
 namespace TM
 {
 
+class Service;
+
 /*!
  * \brief データベースとの通信に使うデータ構造です。
  */
@@ -131,6 +135,11 @@ private:
        storage_type m_links;
 };
 
+/*!
+ * \brief エディタで編集される対訳構造のためのクラスです。
+ *
+ * SocketConnection内でTextSegmentに内蔵されて保持されます。
+ */
 class TextSentence
 {
 public:
@@ -171,7 +180,7 @@ public:
        const QList<sentence_data_type::const_pointer> &candidates() const;
 
        bool is_loaded() const;
-       void set_loaded(bool loaded);
+       //void set_loaded(bool loaded);
 
        QString debug_dump() const;
 
@@ -179,9 +188,9 @@ public:
                                                  quint32 crc, Text::pointer source_sentence);
 
 private:
-       Text::pointer m_source_sentence;
-       Text::pointer m_target_sentence;
-       WordLinker m_linker;
+       Text::pointer m_source_sentence; // 原文
+       Text::pointer m_target_sentence; // 訳文
+       WordLinker m_linker; // 単語間のリンク
 
        int m_segment_id;
        int m_index;
@@ -190,14 +199,108 @@ private:
        quint32 m_previous_crc;
        quint32 m_next_crc;
 
-       quint32 m_source_id;
-       quint32 m_target_id;
+       quint32 m_source_id; // 原文のID
+       quint32 m_target_id; // 訳文のID
 
        QList<sentence_data_type::const_pointer> m_candidates; /*!< 訳文候補 */
+};
+
+/*!
+ * \brief セグメントとHTMLを対応付けるためのデータ構造です。
+ */
+class HtmlData : public RangeData
+{
+public:
+       typedef std::shared_ptr<HtmlData> pointer;
+
+       enum : int { Type = UserData::User + 1, };
+
+private:
+       HtmlData(HtmlNode node_, int begin_, int tail_);
+
+public:
+       int type() const;
+       HtmlNode node();
+
+       QString debug_dump() const;
+
+       static pointer create(HtmlNode node_, int begin_, int tail_);
+
+private:
+       HtmlNode m_node;
+};
+
+/*!
+ * \brief 一つのパラグラフを保持するクラスです。
+ *
+ * 一つのパラグラフには複数の文があります。
+ */
+class TextSegment
+{
+public:
+       typedef std::shared_ptr<TextSegment> pointer;
+       typedef QList<TextSentence::pointer> storage_type;
+       typedef storage_type::iterator iterator;
 
-       bool m_loaded; /*!< 完全一致訳文の初期検索が終了していればtrue */
+private:
+       TextSegment(Service *service, int scode, int segment_id, QString source);
+public:
+
+       int segment_id() const;
+
+       int size() const;
+       TextSentence::pointer at(int index);
+       iterator begin();
+       iterator end();
+
+       QString to_html();
+       QString to_html_from_source(TextSentence::pointer sentence);
+       QString to_html_from_target(TextSentence::pointer sentence);
+
+       HtmlNode::pointer find_html_node_by_offset(int offset);
+
+       static pointer create(
+                       Service *service, int scode, int segment_id, QString source);
+
+private:
+       // リスト用
+       int m_segment_id; /*!< data-wordring-segmentの値によるセグメントのID。 */
+
+       // HTMLページとの対応用
+       HtmlDocument m_document; /*!< セグメントのHtmlDocument。 */
+       Text::pointer m_text; /*!< セグメントのHtmlData付テキスト。 */
+
+       // 編集用
+       storage_type m_sentences; /*!< 編集用センテンスのリスト。 */
 };
 
+/*!
+ * \brief 一つのHTMLページを表現するクラスです。
+ *
+ * オーナーはSocketConnectionです。
+ */
+class TextSegmentList
+{
+public:
+       TextSegmentList(Service *service);
+
+       TextSegment::pointer at(int segment_id);
+       TextSegment::pointer append(int scode, QString html_source);
+
+private:
+       Service *m_service;
+
+       QList<TextSegment::pointer> m_segments;
+       int m_current_segment; /*!< 編集中のセグメントを表す。 */
+
+       int m_scode; /*!< 原文言語コード。*/
+       int m_tcode; /*!< 訳文言語コード。 */
+
+       /*! 原文IDと編集文のマルチ・マップ。 */
+       QMap<int, TextSentence::pointer> m_source_id_map;
+};
+
+
 } // namespace TM
 
 #endif // TMTEXT_H
index 9e61aef..8fdb186 100644 (file)
Binary files a/proxy/wordring.ico and b/proxy/wordring.ico differ
diff --git a/third-party/OleanderStemmingLibrary/BUILD.txt b/third-party/OleanderStemmingLibrary/BUILD.txt
new file mode 100644 (file)
index 0000000..7cfea39
--- /dev/null
@@ -0,0 +1,11 @@
+example.cpp demonstrates how to include the stemming library into your projects.
+
+GCC:
+
+Run this to compile the sample:
+
+g++ example.cpp -o TestStemmer
+
+To run the sample:
+
+./TestStemmer
diff --git a/third-party/OleanderStemmingLibrary/Change Log.txt b/third-party/OleanderStemmingLibrary/Change Log.txt
new file mode 100644 (file)
index 0000000..60b9ef3
--- /dev/null
@@ -0,0 +1,68 @@
+2015 Release
+----------------------------------
+1. Overhaul of Doxygen documentation.
+2. Updates to compile with GCC.
+3. Files are now UTF-8 (without BOM) encoded, which is compatible with Visual Studio 2008 and GCC. Note that this is no longer compatible with earlier versions of Visual Studio.
+
+2010 Release
+----------------------------------
+1. Added Russian stemmer.
+2. Documentation expanded.
+
+2009.1 Release
+----------------------------------
+1. Added support for smart apostrophes.
+
+
+2009 Release
+----------------------------------
+1. Removed "common_lang_constants.cpp" so that the library now consists only of header files.
+
+
+2.0 Release
+----------------------------------
+NOTE: This release is now only compatible with std::wstring (Unicode strings). If you need to stem an ANSI string, then convert it to a wstring using mbstowcs and then stem the wstring.
+
+1. All extended ASCII characters are written in numeric value, so that you can compile on GCC without needing to encode the source code files to UTF-8.
+2. Fixed a few access violations.
+3. Fixed a bug in step1 of the French stemmer.
+4. Updated the English and Spanish stemmers to the newer 2006 algorithms.
+5. General optimizations.
+
+1.2 Release
+----------------------------------
+1. Fixed a couple of bugs when compiling with GCC.
+
+1.1 Release
+----------------------------------
+1. Fixed an error when compiling with Visual Studio 2005.
+
+1.0 Release
+----------------------------------
+1. Added updates to English, Italian, Spanish, Norwegian, and Portuguese stemmers to include latest changes made to the Porter algorithms.
+2. Fixed case-sensitive comparison bug in Portuguese stemmer.
+3. Fixed bug in Portuguese stemmer where an "i" was sometimes incorrectly removed from the suffix.
+4. Fixed a bug in the English stemmer were some words ending in "e" would be incorrectly stemmed.
+5. Unicode now supported. If the symbol UNICODE is globally defined, stemmers now work with std::wstrings; otherwise, std::strings are expected.
+6. Removed template arguments for stemmers. Now you can just declare "english_stem EnglishStemmer;" instead of "english_stem<char> EnglishStemmer;"and it will know whether to expect either std::wstring or std::string types based on whether UNICODE is enabled.
+7. Now licensed under the BSD license.
+8. Added more helper functions in utilities.h and string_util.h
+
+0.3 Release
+----------------------------------
+1. Fixed index bug in Dutch stemmer (wasn't checking size of string when it should have been).
+2. Fixed a compiler bug where a few inclusions were missing.
+3. Added "round" function to utility library for doing accurate integer rounding.
+4. Removed unused variable in English stemmer.
+5. Fixed compiler cast warning in "find_r2" function.
+6. Fixed access violation in "hash_german_yu", "hash_french_yui", and "hash_italian_ui" caused by one letter words.
+7. Fixed compiler error in stricmp function.
+8. Added "strstr" and "strcspn" char/wchar_t wrappers to string_util.h.
+9. Added "size_of_array" macro to utilities.h.
+10. Removed debugging hack code in "is_either" function in utilities.h.
+
+
+0.2 Release
+----------------------------------
+1. Fixed a couple of syntax errors in Finnish and French stemmers that GCC picked up.
+2. Added support for German variant algorithm, where umlauted words are expanded to the English equivalent.
\ No newline at end of file
diff --git a/third-party/OleanderStemmingLibrary/TestStemmer b/third-party/OleanderStemmingLibrary/TestStemmer
new file mode 100644 (file)
index 0000000..a64db8f
Binary files /dev/null and b/third-party/OleanderStemmingLibrary/TestStemmer differ
diff --git a/third-party/OleanderStemmingLibrary/docs.zip b/third-party/OleanderStemmingLibrary/docs.zip
new file mode 100644 (file)
index 0000000..95b3449
Binary files /dev/null and b/third-party/OleanderStemmingLibrary/docs.zip differ
diff --git a/third-party/OleanderStemmingLibrary/example.cpp b/third-party/OleanderStemmingLibrary/example.cpp
new file mode 100644 (file)
index 0000000..bcf5a2f
--- /dev/null
@@ -0,0 +1,80 @@
+#include "stemming/english_stem.h"
+#include "stemming/french_stem.h"
+#include "stemming/german_stem.h"
+#include "stemming/finnish_stem.h"
+#include "stemming/swedish_stem.h"
+#include "stemming/spanish_stem.h"
+#include "stemming/dutch_stem.h"
+#include "stemming/danish_stem.h"
+#include "stemming/italian_stem.h"
+#include "stemming/norwegian_stem.h"
+#include "stemming/portuguese_stem.h"
+#include "stemming/russian_stem.h"
+#include <string>
+#include <iostream>
+
+int main()
+    {
+    //the word to be stemmed
+    std::wstring word(L"transportation");
+    /*create an instance of a "english_stem" class. The template argument for the
+    stemmers are the type of std::basic_string that you are trying to stem, by default 
+    std::wstring (Unicode strings). As long as the char type of your basic_string is wchar_t,
+    then you can use any type of basic_string. This is to say, if your basic_string has a custom
+    char_traits or allocator, then just specify it in your template argument to the stemmer. For example:
+
+    typedef std::basic_string<wchar_t, myTraits, myAllocator> myString;
+    myString word(L"documentation");
+    stemming::english_stem<myString> StemEnglish;
+    StemEnglish(word);*/
+    stemming::english_stem<> StemEnglish;
+    std::wcout << L"(English) Original text:\t" << word.c_str() << std::endl;
+    //the "english_stem" has its operator() overloaded, so you can
+    //treat your class instance like it's a function.  In this case,
+    //pass in the std::wstring to be stemmed.  Note that this alters
+    //the original std::wstring, so when the call is done the string will
+    //be stemmed.
+    StemEnglish(word);
+    //now the variable "word" should equal "document"
+    std::wcout << L"(English) Stemmed text:\t" << word.c_str() << std::endl;
+    //try a similar word that should have the same stem
+    word = L"documenting";
+    std::wcout << L"(English) Original text:\t" << word.c_str() << std::endl;
+    StemEnglish(word);
+    //now the variable "word" should equal "document"
+    std::wcout << L"(English) Stemmed text:\t" << word.c_str() << std::endl;
+
+    //Now try a French word
+    stemming::french_stem<> StemFrench;
+    word = L"continuellement";
+    std::wcout << L"\n(French) Original text:\t" << word.c_str() << std::endl;
+    StemFrench(word);
+    //now the variable "word" should equal "continuel"
+    std::wcout << L"(French) Stemmed text:\t" << word.c_str() << std::endl;
+
+    //Many other stemmers are also available
+    stemming::german_stem<> StemGerman;
+    stemming::finnish_stem<> StemFinnish;
+    stemming::swedish_stem<> StemSwedish;
+    stemming::dutch_stem<> StemDutch;
+    stemming::spanish_stem<> StemSpanish;
+    stemming::italian_stem<> StemItalian;
+    stemming::norwegian_stem<> StemNorwgian;
+    stemming::danish_stem<> StemDanish;
+    stemming::portuguese_stem<> StemPortuguese;
+
+    /*if you are using std::string (ANSI strings) then convert it to a temporary
+    wchar_t buffer, assign that to a std::wstring, and then stem that.*/
+    std::string ANSIWord("documentation");
+    wchar_t* UnicodeTextBuffer = new wchar_t[ANSIWord.length()+1];
+    std::wmemset(UnicodeTextBuffer, 0, ANSIWord.length()+1);
+    std::mbstowcs(UnicodeTextBuffer, ANSIWord.c_str(), ANSIWord.length());
+    word = UnicodeTextBuffer;
+    StemEnglish(word);
+    //now the variable "word" should equal "document"
+    std::wcout << L"\nDemonstrating the stemming of an ANSI string:\n";
+    std::wcout << L"(English) Original text:\t" << ANSIWord.c_str() << std::endl;
+    std::wcout << L"(English) Stemmed text:\t" << word.c_str() << std::endl;
+
+    return 0;
+    }
diff --git a/third-party/OleanderStemmingLibrary/indexing/common_lang_constants.h b/third-party/OleanderStemmingLibrary/indexing/common_lang_constants.h
new file mode 100644 (file)
index 0000000..34801b3
--- /dev/null
@@ -0,0 +1,185 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __COMMON_LANG_CONSTANTS_H__
+#define __COMMON_LANG_CONSTANTS_H__
+
+#include <cwctype>
+
+namespace common_lang_constants
+    {
+    /** \addtogroup Indexing
+    * Punctuation constants.
+    * @{*/
+    const wchar_t TAB = 0x09;
+    const wchar_t SPACE = 0x20;
+    const wchar_t COMMA = 0x2C;
+    const wchar_t LESS_THAN = 60;
+    const wchar_t GREATER_THAN = 62;
+    const wchar_t POUND = 35;
+    const wchar_t AMPERSAND = 38;
+    const wchar_t SEMICOLON = 59;
+    const wchar_t APOSTROPHE = 0x27;
+    const wchar_t DOUBLE_QUOTE = 0x22;
+    const wchar_t QUESTION_MARK = 0x3F;
+    const wchar_t QUESTION_MARK_FULL_WIDTH = 0xFF1F;
+    const wchar_t PERIOD = 0x2E;
+    const wchar_t PERIOD_FULL_WIDTH = 0xFF0E;
+    const wchar_t PERIOD_HALF_WIDTH = 0xFF61;
+    const wchar_t EXCLAMATION_MARK = 0x21;
+    const wchar_t EXCLAMATION_MARK_FULL_WIDTH = 0xFF01;
+    const wchar_t COLON = 0x3A;
+    const wchar_t FORWARD_SLASH = 0x2F;
+    const wchar_t BACK_SLASH = 0x5C;
+    const wchar_t DOLLAR_SIGN = 0x24;
+    const wchar_t PERCENTAGE_SIGN = 0x25;
+    const wchar_t HYPHEN = 0x2D;
+    const wchar_t SOFT_HYPHEN = 0xAD;
+    const wchar_t LEFT_PARENTHESIS = 0x28;
+    const wchar_t LEFT_PARENTHESIS_FULL_WIDTH = 0xFF08;
+    const wchar_t RIGHT_PARENTHESIS = 0x29;
+    const wchar_t RIGHT_PARENTHESIS_FULL_WIDTH = 0xFF09;
+    const wchar_t RIGHT_BRACKET = 0x5D;
+    const wchar_t INTERROBANG = 0x203D;
+    //numbers
+    const wchar_t NUMBER_0 = 0x30;
+    const wchar_t NUMBER_1 = 0x31;
+    const wchar_t NUMBER_2 = 0x32;
+    const wchar_t NUMBER_3 = 0x33;
+    const wchar_t NUMBER_4 = 0x34;
+    const wchar_t NUMBER_5 = 0x35;
+    const wchar_t NUMBER_6 = 0x36;
+    const wchar_t NUMBER_7 = 0x37;
+    const wchar_t NUMBER_8 = 0x38;
+    const wchar_t NUMBER_9 = 0x39;
+    const wchar_t NUMBER_0_FULL_WIDTH = 0xFF10;
+    const wchar_t NUMBER_1_FULL_WIDTH = 0xFF11;
+    const wchar_t NUMBER_2_FULL_WIDTH = 0xFF12;
+    const wchar_t NUMBER_3_FULL_WIDTH = 0xFF13;
+    const wchar_t NUMBER_4_FULL_WIDTH = 0xFF14;
+    const wchar_t NUMBER_5_FULL_WIDTH = 0xFF15;
+    const wchar_t NUMBER_6_FULL_WIDTH = 0xFF16;
+    const wchar_t NUMBER_7_FULL_WIDTH = 0xFF17;
+    const wchar_t NUMBER_8_FULL_WIDTH = 0xFF18;
+    const wchar_t NUMBER_9_FULL_WIDTH = 0xFF19;
+    //constants for letters
+    const wchar_t UPPER_A = 0x41;
+    const wchar_t LOWER_A = 0x61;
+    const wchar_t UPPER_B = 0x42;
+    const wchar_t LOWER_B = 0x62;
+    const wchar_t UPPER_C = 0x43;
+    const wchar_t LOWER_C = 0x63;
+    const wchar_t UPPER_D = 0x44;
+    const wchar_t LOWER_D = 0x64;
+    const wchar_t UPPER_E = 0x45;
+    const wchar_t LOWER_E = 0x65;
+    const wchar_t UPPER_F = 0x46;
+    const wchar_t LOWER_F = 0x66;
+    const wchar_t UPPER_G = 0x47;
+    const wchar_t LOWER_G = 0x67;
+    const wchar_t UPPER_H = 0x48;
+    const wchar_t LOWER_H = 0x68;
+    const wchar_t UPPER_I = 0x49;
+    const wchar_t LOWER_I = 0x69;
+    const wchar_t UPPER_J = 0x4A;
+    const wchar_t LOWER_J = 0x6A;
+    const wchar_t UPPER_K = 0x4B;
+    const wchar_t LOWER_K = 0x6B;
+    const wchar_t UPPER_L = 0x4C;
+    const wchar_t LOWER_L = 0x6C;
+    const wchar_t UPPER_M = 0x4D;
+    const wchar_t LOWER_M = 0x6D;
+    const wchar_t UPPER_N = 0x4E;
+    const wchar_t LOWER_N = 0x6E;
+    const wchar_t UPPER_O = 0x4F;
+    const wchar_t LOWER_O = 0x6F;
+    const wchar_t UPPER_P = 0x50;
+    const wchar_t LOWER_P = 0x70;
+    const wchar_t UPPER_Q = 0x51;
+    const wchar_t LOWER_Q = 0x71;
+    const wchar_t UPPER_R = 0x52;
+    const wchar_t LOWER_R = 0x72;
+    const wchar_t UPPER_S = 0x53;
+    const wchar_t LOWER_S = 0x73;
+    const wchar_t UPPER_T = 0x54;
+    const wchar_t LOWER_T = 0x74;
+    const wchar_t UPPER_U = 0x55;
+    const wchar_t LOWER_U = 0x75;
+    const wchar_t UPPER_V = 0x56;
+    const wchar_t LOWER_V = 0x76;
+    const wchar_t UPPER_W = 0x57;
+    const wchar_t LOWER_W = 0x77;
+    const wchar_t UPPER_X = 0x58;
+    const wchar_t LOWER_X = 0x78;
+    const wchar_t UPPER_Y = 0x59;
+    const wchar_t LOWER_Y = 0x79;
+    const wchar_t UPPER_Z = 0x5A;
+    const wchar_t LOWER_Z = 0x7A;
+
+    const wchar_t UPPER_A_ACUTE = 0xC1;
+    const wchar_t LOWER_A_ACUTE = 0xE1;
+    const wchar_t UPPER_E_ACUTE = 0xC9;
+    const wchar_t LOWER_E_ACUTE = 0xE9;
+    const wchar_t UPPER_I_ACUTE = 0xCD;
+    const wchar_t LOWER_I_ACUTE = 0xED;
+    const wchar_t UPPER_O_ACUTE = 0xD3;
+    const wchar_t LOWER_O_ACUTE = 0xF3;
+    const wchar_t LOWER_U_ACUTE = 0xFA;
+    const wchar_t UPPER_U_ACUTE = 0xDA;
+    const wchar_t UPPER_A_CIRCUMFLEX = 0xC2;
+    const wchar_t LOWER_A_CIRCUMFLEX = 0xE2;
+    const wchar_t UPPER_E_CIRCUMFLEX = 0xCA;
+    const wchar_t LOWER_E_CIRCUMFLEX = 0xEA;
+    const wchar_t UPPER_I_CIRCUMFLEX = 0xCE;
+    const wchar_t LOWER_I_CIRCUMFLEX = 0xEE;
+    const wchar_t UPPER_A_TILDE = 0xC3;
+    const wchar_t LOWER_A_TILDE = 0xE3;
+    const wchar_t UPPER_O_TILDE = 0xD5;
+    const wchar_t LOWER_O_TILDE = 0xF5;
+    const wchar_t UPPER_N_TILDE = 0xD1;
+    const wchar_t LOWER_N_TILDE = 0xF1;
+    const wchar_t UPPER_O_STROKE = 0xD8;
+    const wchar_t LOWER_O_STROKE = 0xF8;
+    const wchar_t UPPER_C_CEDILLA = 0xC7;
+    const wchar_t LOWER_C_CEDILLA = 0xE7;
+    const wchar_t UPPER_A_UMLAUTS = 0xC4;
+    const wchar_t LOWER_A_UMLAUTS = 0xE4;
+    const wchar_t UPPER_O_UMLAUTS = 0xD6;
+    const wchar_t LOWER_O_UMLAUTS = 0xF6;
+    const wchar_t UPPER_E_UMLAUTS = 0xCB;
+    const wchar_t LOWER_E_UMLAUTS = 0xEB;
+    const wchar_t UPPER_I_UMLAUTS = 0xCF;
+    const wchar_t LOWER_I_UMLAUTS = 0xEF;
+    const wchar_t UPPER_ETH = 0xD0;
+    const wchar_t LOWER_ETH = 0xF0;
+    const wchar_t UPPER_U_UMLAUTS = 0xDC;
+    const wchar_t LOWER_U_UMLAUTS = 0xFC;
+    const wchar_t TILDE = 0x7E;
+    const wchar_t UPPER_A_GRAVE = 0xC0;
+    const wchar_t LOWER_A_GRAVE = 0xE0;
+    const wchar_t UPPER_E_GRAVE = 0xC8;
+    const wchar_t LOWER_E_GRAVE = 0xE8;
+    const wchar_t UPPER_I_GRAVE = 0xCC;
+    const wchar_t LOWER_I_GRAVE = 0xEC;
+    const wchar_t UPPER_O_GRAVE = 0xD2;
+    const wchar_t LOWER_O_GRAVE = 0xF2;
+    const wchar_t UPPER_Y_ACUTE = 0xDD;
+    const wchar_t LOWER_Y_ACUTE = 0xFD;
+    const wchar_t ESZETT = 0xDF; //a.k.a. "sharp s"
+    const wchar_t Y_UMLAUT = 0xFF;
+    const wchar_t ELLIPSE = 0x2026;
+    const wchar_t COMPOUND_WORD_SEPARATORS[5] = { HYPHEN, SOFT_HYPHEN, FORWARD_SLASH, BACK_SLASH, 0 };
+    const wchar_t NUMBERS_AND_DOT[22] = {
+        NUMBER_0, NUMBER_1, NUMBER_2, NUMBER_3, NUMBER_4,
+        NUMBER_5, NUMBER_6, NUMBER_7, NUMBER_8, NUMBER_9,
+        NUMBER_0_FULL_WIDTH, NUMBER_1_FULL_WIDTH, NUMBER_2_FULL_WIDTH, NUMBER_3_FULL_WIDTH, NUMBER_4_FULL_WIDTH,
+        NUMBER_5_FULL_WIDTH, NUMBER_6_FULL_WIDTH, NUMBER_7_FULL_WIDTH, NUMBER_8_FULL_WIDTH, NUMBER_9_FULL_WIDTH,
+        PERIOD, 0 };
+    }
+
+#endif //__COMMON_LANG_CONSTANTS_H__
diff --git a/third-party/OleanderStemmingLibrary/indexing/string_util.h b/third-party/OleanderStemmingLibrary/indexing/string_util.h
new file mode 100644 (file)
index 0000000..526a03b
--- /dev/null
@@ -0,0 +1,1232 @@
+/**
+\date 2003-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __STRING_UTIL_H__
+#define __STRING_UTIL_H__
+
+#include <cstdio>
+#include <cstdlib>
+#include <memory>
+#include <cwctype>
+#include <cctype>
+#include <cstring>
+#include <cwchar>
+#include <cstddef>
+#include <string>
+#include <functional>
+#include <cassert>
+#include <clocale>
+#include <stdexcept>
+#include "common_lang_constants.h"
+#include "../utilities/safe_math.h"
+#include "../utilities/utilities.h"
+#include "../utilities/debug_logic.h"
+
+namespace string_util
+    {
+    ///lowercases any Western European alphabetic characters
+    inline wchar_t tolower_western(const wchar_t c)
+        {
+        return ((c >= L'A') && (c <= L'Z')) ||
+            ((c >= 0xC0) && (c <= 0xD6)) ||
+            ((c >= 0xD8) && (c <= 0xDE))
+                ? (c + 32) : c;
+        }
+
+    ///ANSI C decorators
+    ///strtol
+    inline double strtol(const char* str, char** strend, int radix)
+        { return std::strtol(str, strend, radix); }
+    inline double strtol(const wchar_t* str, wchar_t** strend, int radix)
+        { return std::wcstol(str, strend, radix); }
+    ///strtod
+    inline double strtod(const char* str, char** strend)
+        { return std::strtod(str, strend); }
+    inline double strtod(const wchar_t* str, wchar_t** strend)
+        { return std::wcstod(str, strend); }
+    ///atoi
+    inline int atoi(const char* str)
+        {
+        if (str == NULL)
+            { return 0; }
+        return std::atoi(str);
+        }
+    inline int atoi(const wchar_t* str)
+        {
+        if (str == NULL)
+            { return 0; }
+        wchar_t* dummy = NULL;
+        return static_cast<int>(std::wcstol(str, &dummy, 10));
+        }
+    ///atol
+    inline long atol(const char* str)
+        {
+        if (str == NULL)
+            { return 0; }
+        return std::atol(str);
+        }
+    inline long atol(const wchar_t* str)
+        {
+        if (str == NULL)
+            { return 0; }
+        wchar_t* dummy = NULL;
+        return std::wcstol(str, &dummy, 10);
+        }
+    ///tolower
+    inline int tolower(char c)
+        {
+        return std::tolower(static_cast<unsigned char>(c));
+        }
+    inline wchar_t tolower(wchar_t c)
+        {
+        return std::towlower(c);
+        }
+    ///toupper
+    inline int toupper(char c)
+        {
+        return std::toupper(static_cast<unsigned char>(c));
+        }
+    inline wchar_t toupper(wchar_t c)
+        {
+        return std::towupper(c);
+        }
+    ///memset
+    template<typename T>
+    inline T* memset(T* dest, int c, size_t count)
+        {
+        return static_cast<T*>(std::memset(dest, c, count));
+        }
+    //partial specialized versions of memset
+    inline char* memset(char* dest, int c, size_t count)
+        {
+        return static_cast<char*>(std::memset(dest, c, count));
+        }
+    inline wchar_t* memset(wchar_t* dest, int c, size_t count)
+        {
+        return std::wmemset(dest, static_cast<wchar_t>(c), count);
+        }
+    ///strchr
+    inline const char* strchr(const char* s, int ch)
+        {
+        return std::strchr(s, ch);
+        }
+    inline const wchar_t* strchr(const wchar_t* s, wchar_t ch)
+        {
+        return std::wcschr(s, ch);
+        }
+    ///strstr
+    inline const char* strstr(const char* s1, const char* s2)
+        {
+        return std::strstr(s1, s2);
+        }
+    inline const wchar_t* strstr(const wchar_t* s1, const wchar_t* s2)
+        {
+        return std::wcsstr(s1, s2);
+        }
+    ///strcspn
+    inline size_t strcspn(const char* string1,const char* string2)
+        {
+        return std::strcspn(string1, string2);
+        }
+    inline size_t strcspn(const wchar_t* string1,const wchar_t* string2)
+        {
+        return std::wcscspn(string1, string2);
+        }
+    ///strncat
+    inline char* strncat(char* strDest, const char* strSource, size_t count)
+        {
+        return std::strncat(strDest, strSource, count);
+        }
+    inline wchar_t* strncat(wchar_t* strDest, const wchar_t* strSource, size_t count)
+        {
+        return std::wcsncat(strDest, strSource, count);
+        }
+    ///wctomb
+    inline int wctomb(wchar_t* s, wchar_t wc)
+        {
+        s[0] = wc;
+        return -1;
+        }
+    inline int wctomb(char* s, wchar_t wc)
+        {
+        return std::wctomb(s, wc);
+        }
+    //strlen
+    inline size_t strlen(const char* text) { return std::strlen(text); }
+    inline size_t strlen(const wchar_t* text)
+        { return std::wcslen(text); }
+    ///strcmp
+    inline int strcmp(const char* string1, const char* string2)
+        {
+        return std::strcmp(string1, string2);
+        }
+    inline int strcmp(const wchar_t* string1, const wchar_t* string2)
+        {
+        return std::wcscmp(string1, string2);
+        }
+    ///strncmp
+    inline int strncmp(const char* string1, const char* string2, size_t count)
+        {
+        return std::strncmp(string1, string2, count);
+        }
+    inline int strncmp(const wchar_t* string1, const wchar_t* string2, size_t count)
+        {
+        return std::wcsncmp(string1, string2, count);
+        }
+    ///strncpy
+    inline char* strncpy(char* strDest, const char* strSource, size_t count)
+        {
+        return std::strncpy(strDest, strSource, count);
+        }
+    inline wchar_t* strncpy(wchar_t* strDest, const wchar_t* strSource, size_t count)
+        {
+        return std::wcsncpy(strDest, strSource, count);
+        }
+
+    ///functions not available in ANSI C
+    /*Converts an integer value into a string.
+      @param value The integer to convert.
+      @param out The character buffer to write the integer as a string into. This can be either a char* or wchar_t* buffer.
+      @param length The length of the output buffer (in character count).
+      @returns 0 on success, -1 on failure. Will fail if the buffer is either invalid
+      or not large enough to hold the converted value.*/
+    template<typename charT>
+    inline int itoa(long value, charT* out, const size_t length)
+        {
+        if (length == 0 || out == NULL)
+            { return -1; }
+        //space for a negative sign if we need it
+        const size_t signPos = value < 0 ? 1 : 0;
+        size_t i = 0;
+        if (value == 0)
+            { out[i++] = 0x30/*zero*/; }
+        else if (value < 0)
+            {
+            out[i++] = 0x2D/*minus sign*/;
+            value = -value;
+            }
+        while (value > 0 && i+1 < length)
+            {
+            out[i++] = 0x30 + value%10;
+            value /= 10;
+            }
+        /*Not enough space in the buffer or NULL terminator? Clear out the data that we copied
+        into it and return failure.*/
+        if (i+1 == length && value > 0)
+            {
+            std::memset(out,0, length*sizeof(charT));
+            return -1;
+            }
+        out[i] = 0;
+        std::reverse<charT*>(out+signPos, out+i);
+        return 0;
+        }
+    
+    /**Determines whether a character is a space, tab, or newline. Also includes double-width and no break spaces.
+    @param ch The letter to be analyzed.*/
+    template<typename T>
+    inline bool is_space(const T ch)
+        {
+        return (ch == 0x20) ?
+            true : (ch == 0x0D) ?
+            true : (ch == 0x0A) ?
+            true : (ch == 0x09) ?
+            true : (ch == 0xA0/*no break space*/) ?
+            true : (ch == 0x3000/*Japanese Ideographic Space*/) ?
+            true : (ch == 0x200B/*Zero-width space*/) ?
+            true : false;
+        }
+
+    /**Determines whether a character is a hexademical digit (0-9,A-F,a-f).
+    @param ch The letter to be analyzed.*/
+    template<typename T>
+    inline bool is_hex_digit(const T ch)
+        {
+        return (iswdigit(wchar_t(ch)) ||
+            ((ch >= 0x61/*'a'*/ && ch <= 0x66/*'f'*/) ||
+            (ch >= 0x41/*'A'*/ && ch <= 0x46/*'F'*/)) );
+        }
+
+    /**Converts string in hex format to int. Default figures out how much of the string
+    is a valid hex string, but passing a value to the second parameter overrides this
+    and allows you to indicate how much of the string to try to convert.
+    @param hexStr The string to convert.
+    @length How much of the string to analyze. The value -1 (the default) will tell the function
+    to read until there are no more valid hexadecimal digits.
+    @returns The value of the string as an integer.*/
+    template<typename T>
+    inline int axtoi(const T* hexStr, size_t length = -1)
+        {
+        if (hexStr == NULL || *hexStr == 0 || length == 0)
+            { return 0; }
+        //skip leading 0x
+        if (hexStr[0] == 0x30/*0*/ &&
+            length != 1 &&
+            is_either<T>(hexStr[1], 0x78/*x*/, 0x58/*X*/))
+            {
+            hexStr += 2;
+            //if they specified a length to read then take into account the 0x that we just skipped over
+            if (length != static_cast<size_t>(-1) && length >= 2)
+                {
+                length -= 2;
+                if (length == 0)//just a 0x string, then we're done
+                    { return 0; }
+                }
+            }
+        if (length == static_cast<size_t>(-1))
+            {
+            const T* currentPos = hexStr;
+            do
+                {
+                if (currentPos[0] == 0 || !string_util::is_hex_digit(currentPos[0]))
+                    { break; }
+                }
+            while (currentPos++);
+
+            length = currentPos-hexStr;
+            //if no valid hex digits then fail and return zero
+            if (length == 0)
+                { return 0; }
+            }
+        size_t strPos = 0;
+        int intValue = 0;
+        //storage for converted values
+        int* digits = new int[length+1]; std::auto_ptr<int> digitsDeleter(digits);
+        std::memset(digits, 0, sizeof(int)*(length+1));
+        while (strPos < length)
+            {
+            if (hexStr[strPos] == 0)
+                break;
+            //0-9
+            if (is_within<T>(hexStr[strPos], common_lang_constants::NUMBER_0, common_lang_constants::NUMBER_9) )
+                digits[strPos] = (hexStr[strPos]&0x0F);
+            //A-F
+            else if (is_within<T>(hexStr[strPos], common_lang_constants::LOWER_A, common_lang_constants::LOWER_F) ||
+                     is_within<T>(hexStr[strPos], common_lang_constants::UPPER_A, common_lang_constants::UPPER_F) )
+                digits[strPos] = (hexStr[strPos]&0x0F)+9;
+            else
+                { break; }
+            ++strPos;
+            }
+        const size_t count = strPos;
+        size_t digitPos = strPos - 1;
+        strPos = 0;
+        while (strPos < count)
+            {
+            //shift OR the bits into return value.
+            intValue = intValue | (digits[strPos] << (digitPos << 2));
+            --digitPos;
+            ++strPos;
+            }
+
+        return intValue;
+        }
+
+    /**Returns the number of characters in the string pointed to by str, not including the
+    terminating '\0' character, but at most maxlen. In doing this, strnlen looks only at
+    the first maxlen characters at str and never beyond str+maxlen. This function should be used
+    for input that may not be NULL terminated.
+       @param str The string to review.
+       @param maxlen The maximum length of the string to scan.
+       @returns the valid length of the string or maxlen, whichever is shorter.*/
+    template<typename T>
+    inline size_t strnlen(const T* str, const size_t maxlen)
+        {
+        if (!str || maxlen == 0)
+            { return 0; }
+        size_t i;
+        for (i = 0; i < maxlen && str[i]; ++i);
+        return i;
+        }
+
+    ///search for substring in string (case-insensitive)
+    template<typename T>
+    inline const T* stristr(const T* string, const T* strSearch)
+        {
+        if (!string || !strSearch || *strSearch == 0)
+            { return NULL; }
+        while (*string)
+            {
+            //compare the characters one at a time
+            size_t i = 0;
+            for (i = 0; strSearch[i] != 0; ++i)
+                {
+                if (string[i] == 0)
+                    { return NULL; }
+                if (string_util::tolower(strSearch[i]) != string_util::tolower(string[i]) )
+                    {
+                    ++string;
+                    break;
+                    }
+                }
+            //if the substring loop completed then the substring was found
+            if (strSearch[i] == 0)
+                { return string; }
+            }
+        return NULL;
+        }
+
+    /**Searches for substring in a larger string (case-insensitively), limiting the search
+    to a specified number of characters.*/
+    template<typename T>
+    inline const T* strnistr(const T* string, const T* strSearch, const size_t string_len)
+        {
+        if (!string || !strSearch || string_len == 0 || *strSearch == 0)
+            { return NULL; }
+        for (size_t i = 0; i < string_len; ++i)
+            {
+            //compare the characters one at a time
+            size_t j = 0;
+            for (j = 0; strSearch[j] != 0; ++j)
+                {
+                if ((i+j) >= string_len || string[i+j] == 0)
+                    { return NULL; }
+                if (string_util::tolower(strSearch[j]) != string_util::tolower(string[i+j]) )
+                    { break; }
+                }
+            //if the substring loop completed then the substring was found
+            if (strSearch[j] == 0)
+                { return (string+i); }
+            }
+        return NULL;
+        }
+
+    /**Search string in reverse for substring.
+    "offset" is how far we are in the source string already and how far
+    to go back.*/
+    template<typename T>
+    inline const T* strrstr(const T* string,
+                    const T* search,
+                    size_t offset)
+        {
+        if (!string || !search)
+            { return NULL; }
+        const size_t len = string_util::strlen(search);
+        if (len > offset) return NULL;
+        string -= len;
+        offset -= len;
+        bool fnd = false;
+        while (!fnd && offset > 0)
+            {
+            fnd = true;
+            for (size_t i=0; i < len; ++i)
+                {
+                if (string[i] != search[i])
+                    {
+                    fnd = false;
+                    break;
+                    }
+                }
+            if (fnd) return string;
+            --string;
+            --offset;
+            }
+        return NULL;
+        }
+
+    ///Case-insensitive comparison by character count.
+    template<typename T>
+    inline int strnicmp(const T* first, const T* last, size_t count)
+        {
+        //first check if either of the strings are NULL
+        if (!first && !last)
+            { return 0; }
+        else if (!first && last)
+            { return -1; }
+        else if (first && !last)
+            { return 1; }
+
+        int f,l;
+        int result = 0;
+
+        if (count)
+            {
+            do
+                {
+                f = string_util::tolower(*(first++) );
+                l = string_util::tolower(*(last++) );
+                } while ( (--count) && f && (f == l) );
+            result = static_cast<int>(f - l);
+            }
+        return result;
+        }
+
+    ///Case-insensitive comparison.
+    template<typename T>
+    inline int stricmp(const T* first, const T* last)
+        {
+        //first check if either of the strings are NULL
+        if (!first && !last)
+            { return 0; }
+        else if (!first && last)
+            { return -1; }
+        else if (first && !last)
+            { return 1; }
+
+        int f,l;
+        do
+            {
+            f = string_util::tolower(*(first++) );
+            l = string_util::tolower(*(last++) );
+            } while (f && (f == l) );
+
+        return static_cast<int>(f - l);
+        }
+
+    /**Natural order comparison functions.
+    Compare, recognizing numeric strings.*/
+    template<typename T>
+    inline int strnatordcmp(const T* first_string, const T* second_string, bool case_insensitive = false)
+        {
+        //first check if either of the strings are NULL
+        if (!first_string && !second_string)
+            { return 0; }
+        else if (!first_string && second_string)
+            { return -1; }
+        else if (first_string && !second_string)
+            { return 1; }
+
+        size_t first_string_index = 0, second_string_index = 0;
+        T ch1, ch2;
+        while (true)
+            {
+            ch1 = first_string[first_string_index];
+            ch2 = second_string[second_string_index];
+
+            //skip leading spaces
+            while (is_space(ch1))
+                { ch1 = first_string[++first_string_index]; }
+
+            while (is_space(ch2))
+                { ch2 = second_string[++second_string_index]; }
+
+            //process run of digits
+            if (iswdigit(ch1) && iswdigit(ch2))
+                {
+                T *firstEnd, *secondEnd;
+                double firstDouble = string_util::strtod(first_string+first_string_index, &firstEnd);
+                double secondDouble = string_util::strtod(second_string+second_string_index, &secondEnd);
+
+                if (firstDouble < secondDouble)
+                    { return -1; }
+                else if (firstDouble > secondDouble)
+                    { return 1; }
+                else //numbers are equal
+                    {
+                    //if this was the end of both strings then they are equal
+                    if (*firstEnd == 0 && *secondEnd == 0)
+                        { return 0; }
+                    /*the first string is done, but there is more to the second string
+                    after the number, so first is smaller*/
+                    else if (*firstEnd == 0)
+                        { return -1; }
+                    /*the second string is done, but there is more to the first string
+                    after the number, so first is bigger*/
+                    else if (*secondEnd == 0)
+                        { return 1; }
+                    //there is more to both of them, so move the counter and move on
+                    else
+                        {
+                        first_string_index = (firstEnd - first_string);
+                        second_string_index = (secondEnd - second_string);
+                        continue;
+                        }
+                    }
+                }
+
+            //if we are at the end of the strings then they are the same
+            if (ch1 == 0 && ch2 == 0)
+                { return 0; }
+
+            if (case_insensitive)
+                {
+                ch1 = string_util::tolower(ch1);
+                ch2 = string_util::tolower(ch2);
+                }
+
+            if (ch1 < ch2)
+                { return -1; }
+            else if (ch1 > ch2)
+                { return 1; }
+
+            ++first_string_index;
+            ++second_string_index;
+            }
+        }
+
+    ///Compare, recognizing numeric strings and ignoring case.
+    template<typename T>
+    inline int strnatordncasecmp(const T* a, const T* b)
+        {
+        return strnatordcmp(a, b, true);
+        }
+
+    ///Indicates whether a larger strings ends with the specified suffix. Lengths are provided
+    ///by the caller for efficiency. This function is case sensitive.
+    template<typename T>
+    inline bool has_suffix(const T* text, const size_t text_length, const T* suffix, const size_t suffix_length)
+        {
+        if (text == NULL || suffix == NULL || text_length <= suffix_length)
+            { return false; }
+        return (string_util::strnicmp(text+(text_length-suffix_length), suffix, suffix_length) == 0);
+        }
+
+    /**Searches for a matching tag, skipping an extra open/close pairs of symbols in between.
+    @param openSymbol The opening symbol.
+    @param closeSymbol The closing symbol that we are looking for.
+    @param fail_on_overlapping_open_symbol Whether it should immediately return failure if an open
+    symbol is found before a matching close symbol.
+    @returns a pointer to where the closing tag is, or NULL if one can't be found.*/
+    template<typename T>
+    inline const T* find_matching_close_tag(const T* string, const T openSymbol, const T closeSymbol,
+                                            const bool fail_on_overlapping_open_symbol = false)
+        {
+        if (!string)
+            { return NULL; }
+        long open_stack = 0;
+        while (*string)
+            {
+            if (string[0] == openSymbol)
+                {
+                if (fail_on_overlapping_open_symbol)
+                    { return NULL; }
+                ++open_stack;
+                }
+            else if (string[0] == closeSymbol)
+                {
+                if (open_stack == 0)
+                    { return string; }
+                --open_stack;
+                }
+            ++string;
+            }
+        return NULL;
+        }
+
+    ///Searches for a matching tag, skipping an extra open/close pairs of symbols in between.
+    template<typename T>
+    inline const T* find_matching_close_tag(const T* string, const T* openSymbol,
+                                            const T* closeSymbol)
+        {
+        if (!string || !openSymbol || !closeSymbol)
+            { return NULL; }
+        const size_t openSymbolLength = string_util::strlen(openSymbol);
+        const size_t closeSymbolLength = string_util::strlen(closeSymbol);
+        if (openSymbolLength == 0 || closeSymbolLength == 0)
+            { return NULL; }
+        long open_stack = 0;
+        const T openSymbolFirstCharacter = openSymbol[0];
+        const T closeSymbolFirstCharacter = closeSymbol[0];
+        while (*string)
+            {
+            //to prevent unnecessary calls to strncmp, we check the current character first
+            if (string[0] == openSymbolFirstCharacter &&
+                     string_util::strncmp(string,openSymbol,openSymbolLength) == 0)
+                {
+                ++open_stack;
+                string += openSymbolLength;
+                continue;
+                }
+            else if (string[0] == closeSymbolFirstCharacter &&
+                     string_util::strncmp(string,closeSymbol,closeSymbolLength) == 0)
+                {
+                if (open_stack == 0)
+                    { return string; }
+                --open_stack;
+                }
+            ++string;
+            }
+        return NULL;
+        }
+
+    /**Search for a single character in a string for n number of characters.
+    Size argument should be less than or equal to the length of the string being searched.
+    @param string The string to search in.
+    @param ch The character to search for.
+    @param size The size of the search string.
+    @returns A pointer in the string where the character was found, or NULL if not found.*/
+    template<typename T>
+    inline const T* strnchr(const T* string, const T ch, size_t size)
+        {
+        if (!string)
+            { return NULL; }
+        size_t i = 0;
+        for (i = 0; i < size; ++i)
+            {
+            /*if string being searched is shorter
+            than the size argument then return failure (NULL).*/
+            if (string[i] == 0)
+                {
+                NON_UNIT_TEST_ASSERT(0 && "strnchr: string shorter than size parameter.");
+                return NULL;
+                }
+            if (string[i] == ch)
+                { return string+i; }
+            }
+        return NULL;
+        }
+
+    /**search for a single character from a sequence in a string and
+    return a pointer if found.*/
+    template<typename T>
+    inline const T* strcspn_pointer(const T* string1, const T* string2, const size_t string2Length)
+        {
+        if (!string1 || !string2)
+            { return NULL; }
+        size_t i = 0;
+        while (string1)
+            {
+            if (string1[0] == 0)
+                { return NULL; }
+            for (i = 0; i < string2Length; ++i)
+                {
+                if (string1[0] == string2[i])
+                    { return string1; }
+                }
+            ++string1;
+            }
+        return NULL;
+        }
+
+    /**Search for a single character from a sequence in a string for n number of characters.
+    @param stringToSearch The string to search.
+    @param stringToSearchLength The length of the string being searched.
+    @param searchString The sequence of characters to search for.
+    @param searchStringLength The length of the sequence string.
+    @returns The index into the string that the character was found. Returns the length of the string if not found.*/
+    template<typename T>
+    inline size_t strncspn(const T* stringToSearch, const size_t stringToSearchLength,
+        const T* searchString, const size_t searchStringLength)
+        {
+        if (!stringToSearch || !searchString || stringToSearchLength == 0 || searchStringLength == 0)
+            { return stringToSearchLength; }
+        size_t i = 0, j = 0;
+        for (i = 0; i < stringToSearchLength; ++i)
+            {
+            /*If string being searched is shorter than the size argument then fail.
+            Note that we should pass back the length of the string that the caller passed in
+            so that they know that it failed, not the actual position that we stopped on which would
+            be a NULL termintor.*/
+            if (stringToSearch[i] == 0)
+                {
+                NON_UNIT_TEST_ASSERT(0 && "strncspn: string shorter than size parameter.");
+                return stringToSearchLength;
+                }
+            for (j = 0; j < searchStringLength; ++j)
+                {
+                if (stringToSearch[i] == searchString[j])
+                    { return i; }
+                }
+            }
+        return i;
+        }
+
+    /**search for a single character not from a sequence in a string in reverse.
+    @param string The string to search in.
+    @param search The sequence of characters to skip.
+    @param offset Where to begin the search. If -1, then the reverse search will begin at the end of the string.
+    @returns the position of where the last non-matching character is at, or -1 if it can't be found.*/
+    template<typename T>
+    inline size_t find_last_not_of(const T* string, const T* search,
+                    size_t offset = std::basic_string<T>::npos)
+        {
+        if (!string || !search)
+            { return std::basic_string<T>::npos; }
+        if (offset == std::basic_string<T>::npos)
+            { offset = string_util::strlen(string)-1; }
+
+        size_t i=0;
+        while (offset != std::basic_string<T>::npos)
+            {
+            for (i = 0; search[i] != 0; ++i)
+                {
+                if (string[offset] == search[i])
+                    { break; }
+                }
+            //If the whole search string wasn't scanned, then there was a match. Move on.
+            if (search[i] != 0)
+                {
+                if (offset == 0)
+                    { return std::basic_string<T>::npos; }
+                --offset;
+                }
+            else
+                { return offset; }
+            }
+        return std::basic_string<T>::npos;
+        }
+
+    /**search for the last instance of a character in a string in reverse.
+    @param string The string to search.
+    @param ch The character to search for.
+    @param offset The offset in the string to begin the search from. The default (-1) will begin the search at the end of the string.
+    @returns The offset of the found character, or -1 if not found.*/
+    template<typename T>
+    inline size_t find_last_of(const T* string,
+                    const T ch,
+                    size_t offset = -1)
+        {
+        if (!string)
+            { return static_cast<size_t>(-1); }
+        if (offset == static_cast<size_t>(-1))
+            { offset = string_util::strlen(string)-1; }
+
+        while (offset != static_cast<size_t>(-1))
+            {
+            if (string[offset] == ch)
+                { return offset; }
+            --offset;
+            }
+        return static_cast<size_t>(-1);
+        }
+
+    /*search for the first occurrence that is not a character from a sequence in
+    a string for n number of characters and returns zero-based index if found.
+    @param stringToSearch The string to search.
+    @param stringToSearchLength The length of the string being searched.
+    @param searchString The sequence of characters to perform a reverse match with.
+    @param searchStringLength The length of the character sequence.
+    @returns The index into the string that the character was not found, or 
+    the length of the string if nothing was found that couldn't match the search string.*/
+    template<typename T>
+    inline size_t find_first_not_of(const T* stringToSearch, const size_t stringToSearchLength,
+                                    const T* searchString, const size_t searchStringLength)
+        {
+        if (!stringToSearch || !searchString || stringToSearchLength == 0 || searchStringLength == 0)
+            { return stringToSearchLength; }
+        size_t i = 0, j = 0;
+        for (i = 0; i < stringToSearchLength; ++i)
+            {
+            /*If string being searched is shorter
+            than the size argument then return string length to indicate failure to find anything.
+            Although this isn't really the index that we stopped in, this will tell the caller that
+            the search failed.*/
+            if (stringToSearch[i] == 0)
+                {
+                NON_UNIT_TEST_ASSERT(0 && "find_first_not_of: string shorter than size parameter.");
+                return stringToSearchLength;
+                }
+            for (j = 0; j < searchStringLength; ++j)
+                {
+                //stop if a character matching anything in the sequence
+                if (stringToSearch[i] == searchString[j])
+                    { break; }
+                }
+            //if we went through the whole sequence then nothing matched
+            if (j == searchStringLength)
+                { return i; }
+            }
+        return i;
+        }
+
+    //utility classes
+    //equal functors
+    template<typename T>
+    class equal_string_i_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::stricmp(a_, b_) == 0);
+            }
+        };
+
+    template<typename T>
+    class equal_basic_string_i_compare
+        : public std::binary_function<T, T, bool>
+        {
+    public:
+        inline bool operator()(const T& a_, const T& b_) const
+            {
+            return (string_util::stricmp(a_.c_str(), b_.c_str()) == 0);
+            }
+        };
+
+    template<typename T>
+    class equal_string_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::strcmp(a_, b_) == 0);
+            }
+        };
+
+    //less functors
+    template<typename T>
+    class less_string_n_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        less_string_n_compare(size_t comparison_size) : m_comparison_size(comparison_size) {}
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::strncmp(a_, b_, m_comparison_size) < 0);
+            }
+    private:
+        size_t m_comparison_size;
+        };
+
+    template<typename T>
+    class less_string_ni_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        less_string_ni_compare(size_t comparison_size) : m_comparison_size(comparison_size) {}
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::strnicmp(a_, b_, m_comparison_size) < 0);
+            }
+    private:
+        size_t m_comparison_size;
+        };
+
+    template<typename T>
+    class less_string_i_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::stricmp(a_, b_) < 0);
+            }
+        };
+
+    template<typename T>
+    class less_string_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::strcmp(a_, b_) < 0);
+            }
+        };
+
+    template<typename T>
+    class less_basic_string_compare
+        : public std::binary_function<T, T, bool>
+        {
+    public:
+        inline bool operator()(const T& a_, const T& b_) const
+            {
+            return (string_util::strcmp(a_.c_str(), b_.c_str()) < 0);
+            }
+        };
+
+    template<typename T>
+    class less_string_natural_order_i_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::strnatordncasecmp(a_, b_) < 0);
+            }
+        };
+
+    ///trims whitespace from around a string
+    template<typename char_typeT>
+    class string_trim
+        {
+    public:
+        const char_typeT* operator()(const char_typeT* value,
+                                     size_t length = std::basic_string<char_typeT>::npos)
+            {
+            m_trimmed_string_length = 0;
+            if (value == NULL)
+                { return NULL; }
+            if (length == 0)
+                { return value; }
+            if (length == std::basic_string<char_typeT>::npos)
+                { length = string_util::strlen(value); }
+            const char_typeT* start = value;
+            //end is last valid character in the string, not the one after it
+            const char_typeT* end = value+(length-1);
+            while (start && (start <= end))
+                {
+                if (is_space(start[0]))
+                    { ++start; }
+                else
+                    { break; }
+                }
+            while (end > start)
+                {
+                if (is_space(end[0]))
+                    { --end; }
+                else
+                    { break; }
+                }
+            //if start overran end then this string was all spaces.
+            m_trimmed_string_length = (start > end) ? 0 : (end-start)+1;
+            return start;
+            }
+        size_t get_trimmed_string_length() const
+            { return m_trimmed_string_length; }
+    private:
+        size_t m_trimmed_string_length;
+        };
+
+    /** \addtogroup StringOperations
+    * Classes for string operations.
+    * @{*/
+    /**
+    \class string_tokenize
+        Tokenizes a string using a set of delimiters.
+    \date 2010
+    */
+    /** @} */
+    template<typename T>
+    class string_tokenize
+        {
+    public:
+        ///Constructor which takes the string to parse and the delimiters to use.
+        ///@param val The string to parse.
+        ///@param delim The set of delimiters to separate the string.
+        string_tokenize(const T& val, const T& delim) :
+            m_value(val), m_start(NULL), m_next_delim(NULL), m_delim(delim), m_has_more_tokens(true)
+            {
+            m_start = m_value.c_str();
+            m_next_delim = string_util::strcspn_pointer(m_start, m_delim.c_str(), m_delim.length());
+            }
+        ///Returns whether or not there are more tokens in the string.
+        inline bool has_more_tokens() const
+            { return m_has_more_tokens; }
+        ///Returns whether or not there are more delimiters in the string.
+        ///This is useful for seeing if there are any delimiters at all when first loading the string.
+        inline bool has_more_delimiters() const
+            { return (m_next_delim != NULL); }
+        ///Returns the next token from the original string as a string object
+        ///Note that empty tokens can be returned if there is proceeding or trailing
+        ///delimiters in the string, or if there are repeated delimiters next to each other.
+        inline T get_next_token()
+            {
+            if (m_next_delim)
+                {
+                const wchar_t* current_start = m_start;
+                const wchar_t* current_next_delim = m_next_delim;
+                //move the pointers to the next token
+                m_start = ++m_next_delim;
+                m_next_delim = string_util::strcspn_pointer(m_start, m_delim.c_str(), m_delim.length());
+                return T(current_start, current_next_delim-current_start);
+                }
+            //no more delims means that we are on the last token
+            else if (m_start)
+                {
+                m_has_more_tokens = false;
+                const wchar_t* current_start = m_start;
+                m_start = NULL;
+                return T(current_start);
+                }
+            //if called when there are no more tokens, then return an empty string
+            else
+                {
+                m_has_more_tokens = false;
+                return T();
+                }
+            }
+    private:
+        string_tokenize() {}
+        string_tokenize(const string_tokenize&) {}
+
+        T m_value;
+        const wchar_t* m_start;
+        const wchar_t* m_next_delim;
+        T m_delim;
+        bool m_has_more_tokens;
+        };
+
+    ///Removes all whitespace from a string
+    template<typename T>
+    inline T remove_all_whitespace(const T& text)
+        {
+        T tempText = text;
+        for (typename T::size_type i = 0; i < tempText.length(); /*in loop*/)
+            {
+            if (tempText[i] == 10 || tempText[i] == 13 || tempText[i] == 9)
+                { tempText.erase(i,1); }
+            else
+                { ++i; }
+            }
+        return tempText;
+        }
+
+    ///Removes all instances of a character from a string.
+    template<typename Tchar_type, typename T>
+    inline void remove_all(T& text, Tchar_type char_to_replace)
+        {
+        size_t start = 0;
+        while (start != T::npos)
+            {
+            start = text.find(char_to_replace, start);
+            if (start == T::npos)
+                { return; }
+            text.erase(start,1);
+            }
+        }
+
+    ///helper functions for stemmers
+    template<typename Tchar_type, typename T>
+    inline void replace_all(T& text, Tchar_type text_to_replace, Tchar_type replacement_text)
+        {
+        size_t start = 0;
+        while (start != T::npos)
+            {
+            start = text.find(text_to_replace, start);
+            if (start == T::npos)
+                {
+                return;
+                }
+            text[start++] = replacement_text;
+            }
+        }
+
+    template<typename T, typename Tchar_type>
+    inline void replace_all(T& text, const Tchar_type* text_to_replace, const Tchar_type* replacement_text)
+        {
+        size_t start = 0;
+        const size_t textToReplaceLength = string_util::strlen(text_to_replace);
+        while (start != T::npos)
+            {
+            start = text.find(text_to_replace, start);
+            if (start == T::npos)
+                {
+                return;
+                }
+            text.replace(start, textToReplaceLength, replacement_text);
+            }
+        }
+
+    template<typename T>
+    inline void replace_all(T& text, const T& text_to_replace, const T& replacement_text)
+        {
+        size_t start = 0;
+        while (start != T::npos)
+            {
+            start = text.find(text_to_replace, start);
+            if (start == T::npos)
+                {
+                return;
+                }
+            text.replace(start, text_to_replace.length(), replacement_text);
+            }
+        }
+
+    /**strips extraneous spaces/tabs/carriage returns from a block of text so
+    that there isn't more than one space consecutively.*/
+    template<typename string_typeT>
+    size_t remove_extra_spaces(string_typeT& Text)
+        {
+        size_t numberOfSpacesRemoved = 0;
+
+        if (!Text.length() )
+            { return 0; }
+        bool alreadyHasSpace = true;
+        //make sure that there is only a space between each word
+        for (unsigned int i = 0; i < Text.length(); ++i)
+            {
+            //if this is the first space found after the current
+            //word then it's OK--just leave it
+            if (is_space(static_cast<wchar_t>(Text[i])) && !alreadyHasSpace)
+                { alreadyHasSpace = true; }
+            //this is extra space right after another--get rid of it
+            else if (is_space(static_cast<wchar_t>(Text[i])) && alreadyHasSpace)
+                {
+                //make sure it isn't a Windows \r\n
+                if (i && !(Text[i-1] == 13 && Text[i] == 10))
+                    {
+                    ++numberOfSpacesRemoved;
+                    Text.erase(i--,1);
+                    }
+                }
+            //we are starting another word--reset
+            else if (!is_space(static_cast<wchar_t>(Text[i])))
+                { alreadyHasSpace = false; }
+            }
+
+        return numberOfSpacesRemoved;
+        }
+
+    /**Removes blank lines from a block of text
+    @param Text The text to have blank lines removed from.
+    @return Number of characters (not lines) removed from the block.*/
+    template<typename string_typeT>
+    size_t remove_blank_lines(string_typeT& Text)
+        {
+        size_t numberOfLinesRemoved = 0;
+
+        if (!Text.length() )
+            { return 0; }
+        bool alreadyHasNewLine = true;
+        //make sure that there is only a space between each word
+        for (unsigned int i = 0; i < Text.length(); ++i)
+            {
+            //if this is the first space found after the current
+            //word then it's OK--just leave it
+            if (is_either<wchar_t>(static_cast<wchar_t>(Text[i]), 10, 13) && !alreadyHasNewLine)
+                { alreadyHasNewLine = true; }
+            //this is extra space right after another--get rid of it
+            else if (is_either<wchar_t>(static_cast<wchar_t>(Text[i]), 10, 13) && alreadyHasNewLine)
+                {
+                //make sure it isn't a Windows \r\n
+                if (i && !(Text[i-1] == 13 && Text[i] == 10))
+                    {
+                    ++numberOfLinesRemoved;
+                    Text.erase(i--,1);
+                    }
+                }
+            //we are starting another word--reset
+            else if (!is_either<wchar_t>(static_cast<wchar_t>(Text[i]), 10, 13))
+                { alreadyHasNewLine = false; }
+            }
+
+        return numberOfLinesRemoved;
+        }
+
+    /**Converts strings to double values, but also takes into account ranges (returning the average). For example, a string
+    like "5-8" will return 6.5. Hyphens and colons are seen as range separators.*/
+    template<typename Tchar_type>
+    inline double strtod_ex(const Tchar_type* nptr, Tchar_type** endptr)
+        {
+        if (nptr == NULL)
+            {
+            *endptr = NULL;
+            return 0.0f;
+            }
+        wchar_t sepStr[3] = { 0x2D, 0x3A, 0 };
+        const Tchar_type* separator = string_util::strcspn_pointer<Tchar_type>(nptr, sepStr, 2);
+        //if there is no hyphen or there is one but it is at the end then just call strtod
+        if (separator == NULL || *(separator+1) == 0)
+            { return string_util::strtod(nptr, endptr); }
+        else
+            {
+            const double d1 = string_util::strtod(nptr, endptr);
+            const double d2 = string_util::strtod(++separator, endptr);
+            return safe_divide<double>(d1+d2, 2);
+            }
+        }
+
+    template<typename Tchar_type>
+    inline bool is_one_of(const Tchar_type character, const Tchar_type* char_string)
+        {
+        while(*char_string)
+            {
+            if (character == char_string[0])
+                {
+                return true;
+                }
+            ++char_string;
+            }
+        return false;
+        }
+    }
+
+#endif //__STRING_UTIL_H__
diff --git a/third-party/OleanderStemmingLibrary/license.txt b/third-party/OleanderStemmingLibrary/license.txt
new file mode 100644 (file)
index 0000000..92648dc
--- /dev/null
@@ -0,0 +1,11 @@
+Oleander Stemming Library
+Copyright (c) 2015, Oleander Software, Ltd.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the name of Oleander Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/third-party/OleanderStemmingLibrary/stemming/danish_stem.h b/third-party/OleanderStemmingLibrary/stemming/danish_stem.h
new file mode 100644 (file)
index 0000000..ceeb0bc
--- /dev/null
@@ -0,0 +1,338 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __DANISH_STEM_H__
+#define __DANISH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class danish_stem
+        Danish stemming class.
+
+    The Danish alphabet includes the following additional letters:
+        - æ å ø
+
+    The following letters are vowels:
+        - a e i o u y æ å ø
+
+    A consonant is defined as a non-vowel.
+
+    R2 is not used: R1 is defined in the same way as in the German stemmer.
+
+    Define a valid s-ending as one of 
+        - a b c d f g h j k l m n o p r t v y z å
+
+    \par Example:
+    \code
+    std::wstring word(L"ramningen");
+    stemming::danish_stem<myString> StemDanish;
+    StemDanish(word);
+    \endcode
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated: 
+            - hed ethed ered e erede ende erende ene erne ere en heden
+               eren er heder erer heds es endes erendes enes ernes eres
+               ens hedens erens ers ets erets et eret.
+               - Delete.
+            - s
+               - Delete, if preceded by a valid s-ending.
+
+    (Of course the letter of the valid s-ending is not necessarily in R1).
+
+    <b>Step 2:</b>
+
+    Search for one of the following suffixes in R1, and if found delete the last letter.:
+            - gd dt gt kt
+
+    (For example, friskt -> frisk).
+
+    <b>Step 3:</b>
+
+    If the word ends with igst, remove the final st. Search for the longest among the following suffixes in R1, and perform the action indicated:
+            - ig lig elig els
+                - Delete, and then repeat step 2.
+            - løst
+                - Replace with løs.
+
+    <b>Step 4 (undouble):</b>
+
+    If the word ends with double consonant in R1, then remove one of the consonants. 
+
+    (For example, bestemmelse -> bestemmels (step 1) -> bestemm (step 3a) -> bestem in this step).
+    */
+    /** @} */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class danish_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param[in,out] text Danish string to stem.*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                return;
+                }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //see where the R1 section begins
+            //R1 is the first consonant after the first vowel
+            stem<string_typeT>::find_r1(text, DANISH_VOWELS);
+            if (stem<string_typeT>::get_r1() == text.length() )
+                {
+                return;
+                }
+            //R1 must have at least 3 characters in front of it
+            if (stem<string_typeT>::get_r1() < 3)
+                {
+                stem<string_typeT>::set_r1(3);
+                }
+            //danish does not use R2
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+            step_4(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*erendes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erende*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*hedens*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ethed*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erede*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heden*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heder*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*endes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ernes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erens*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erets*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*eres*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*enes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heds*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erer*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*eren*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erne*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ende*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ered*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*eret*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*hed*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ets*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ere*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ene*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ens*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ers*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*et*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 2 &&
+                    string_util::is_one_of(text[text.length()-2], DANISH_ALPHABET) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*gd*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*dt*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*gt*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*kt*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text)
+            {
+            //do this check separately
+            if (stem<string_typeT>::is_suffix(text,/*igst*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            //now start looking for the longest suffix
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*elig*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                step_2(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*løst*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O_STROKE, common_lang_constants::UPPER_O_STROKE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*lig*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                step_2(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*els*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                step_2(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                step_2(text);
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_4(string_typeT& text)
+            {
+            //undouble consecutive (same) consonants if either are in R1 section
+            if (text.length() >= 2 &&
+                stem<string_typeT>::get_r1() <= text.length()-1 &&
+                string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]) )
+                {
+                if (!string_util::is_one_of(text[text.length()-2], DANISH_VOWELS) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        };
+    }
+
+#endif //__DANISH_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/dutch_stem.h b/third-party/OleanderStemmingLibrary/stemming/dutch_stem.h
new file mode 100644 (file)
index 0000000..ebd7781
--- /dev/null
@@ -0,0 +1,317 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __DUTCH_STEM_H__
+#define __DUTCH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    Language-specific stemming classes.
+    * @{*/
+    /**
+    \class dutch_stem
+    Dutch includes the following accented forms:
+    - ä ë ï ö ü á é í ó ú è
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated: 
+            - heden 
+                - Replace with heid if in R1.
+            - en ene 
+                - Delete if in R1 and preceded by a valid en-ending, and then undouble the ending.
+            - s se 
+                - Delete if in R1 and preceded by a valid s-ending.
+
+    <b>Step 2:</b>
+
+    Delete suffix e if in R1 and preceded by a non-vowel, and then undouble the ending.
+
+    <b>Step 3a (heid):</b>
+
+    Delete heid if in R2 and not preceded by c, and treat a preceding en as in step 1(b).
+
+    <b>Step 3b (d-suffixes [*]):</b>
+    
+    Search for the longest among the following suffixes, and perform the action indicated. 
+            - end ing
+                - Delete if in R2.
+                - If preceded by ig, delete if in R2 and not preceded by e, otherwise undouble the ending.
+            - ig
+                - Delete if in R2 and not preceded by e.
+            - lijk
+                - Delete if in R2, and then repeat step 2.
+            - baar
+                - Delete if in R2.
+            - bar
+                - Delete if in R2 and if step 2 actually removed an e.
+
+    <b>Step 4 (undouble vowel):</b>
+    
+    If the words ends CVD, where C is a non-vowel, D is a non-vowel other than I,
+    and V is double a, e, o, or u, then remove one of the vowels from V.
+    
+    (for example, maan -> man, brood -> brod).
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class dutch_stem : public stem<string_typeT>
+        {
+    public:
+        dutch_stem() : m_step_2_succeeded(false) {}
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            //First, remove all umlaut and acute accents
+            stem<string_typeT>::remove_dutch_umlauts(text);
+            stem<string_typeT>::remove_dutch_acutes(text);
+
+            if (text.length() < 3)
+                {
+                return;
+                }
+
+            //reset internal data
+            m_step_2_succeeded = false;
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //Hash initial y, y after a vowel, and i between vowels
+            stem<string_typeT>::hash_dutch_yi(text, DUTCH_VOWELS);
+
+            stem<string_typeT>::find_r1(text, DUTCH_VOWELS);
+            stem<string_typeT>::find_r2(text, DUTCH_VOWELS);
+            //R1 must have at least 3 characters in front of it
+            if (stem<string_typeT>::get_r1() < 3)
+                { stem<string_typeT>::set_r1(3); }
+
+            step_1(text);
+            step_2(text);
+            step_3a(text);
+            step_3b(text);
+            step_4(text);
+
+            //unhash I and Y back into their original form 
+            stem<string_typeT>::unhash_dutch_yi(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*heden*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    text[text.length()-2] = common_lang_constants::LOWER_I;
+                    text[text.length()-1] = common_lang_constants::LOWER_D;
+                    }
+                }
+            ///Define a valid en-ending as a non-vowel, and not gem.
+            else if (stem<string_typeT>::is_suffix(text,/*ene*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E)    )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-3 &&
+                    !string_util::is_one_of(text[text.length()-4], DUTCH_VOWELS) &&
+                    (text.length() < 6 ||
+                    //"gem" in front of "en" ending
+                    !(is_either<wchar_t>(text[text.length()-6], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ) ) )
+                    {
+                    text.erase(text.length()-3);
+                    //undouble dd, kk, tt
+                    if (string_util::is_one_of(text[text.length()-1], DUTCH_KDT) &&
+                        string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]))
+                        { text.erase(text.length()-1); }
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-2 &&
+                    !string_util::is_one_of(text[text.length()-3], DUTCH_VOWELS) &&
+                    (text.length() < 5 ||
+                    !(is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ) ) )
+                    {
+                    text.erase(text.length()-2);
+                    //undouble dd, kk, tt
+                    if (string_util::is_one_of(text[text.length()-1], DUTCH_KDT) &&
+                        string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]) )
+                        { text.erase(text.length()-1); }
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (text.length() >= 3 &&
+                stem<string_typeT>::is_suffix(text,/*se*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                !string_util::is_one_of(text[text.length()-3], DUTCH_S_ENDING))
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            ///Define a valid s-ending as a non-vowel other than j
+            else if (text.length() >= 2 &&
+                stem<string_typeT>::is_suffix(text, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                !string_util::is_one_of(text[text.length()-2], DUTCH_S_ENDING))
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-1)
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            }
+
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (text.length() >= 2 &&
+                    stem<string_typeT>::get_r1() <= text.length()-1 &&
+                    !string_util::is_one_of(text[text.length()-2], DUTCH_VOWELS) )
+                    {
+                    //watch out for vowel I/Y vowel
+                    if (text.length() >= 3 &&
+                        string_util::is_one_of(text[text.length()-2], L"iyIY") &&
+                        string_util::is_one_of(text[text.length()-3], DUTCH_VOWELS) )
+                        { return; }
+                    else
+                        {
+                        text.erase(text.length()-1);
+                        //undouble dd, kk, tt
+                        if (string_util::is_one_of(text[text.length()-1], DUTCH_KDT) &&
+                            string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]))
+                            { text.erase(text.length()-1); }
+                        stem<string_typeT>::update_r_sections(text);
+                        m_step_2_succeeded = true;
+                        }
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_3a(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*heid*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_r2() <= text.length()-4 &&
+                    is_neither<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    if (stem<string_typeT>::get_r1() <= text.length()-2 &&
+                        stem<string_typeT>::is_suffix(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                        {
+                        if ((!string_util::is_one_of(text[text.length()-3], DUTCH_VOWELS) ||
+                            (string_util::is_one_of(text[text.length()-3], L"iyYI") &&
+                            string_util::is_one_of(text[text.length()-4], DUTCH_VOWELS))) &&
+                            (text.length() < 5 ||
+                            !(is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                            is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                            is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ) ) )
+                            {
+                            text.erase(text.length()-2);
+                            //undouble dd, kk, tt
+                            if (string_util::is_one_of(text[text.length()-1], DUTCH_KDT) &&
+                                string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]))
+                                { text.erase(text.length()-1); }
+                            stem<string_typeT>::update_r_sections(text);
+                            }
+                        }
+                    return;
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_3b(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r2(text,/*end*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ing*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                stem<string_typeT>::update_r_sections(text);
+                if (text.length() > 3)
+                    {
+                    if (is_neither<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E , common_lang_constants::UPPER_E) &&
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                        {
+                        stem<string_typeT>::update_r_sections(text);
+                        return;
+                        }
+                    else
+                        {
+                        if (string_util::is_one_of(text[text.length()-1], DUTCH_KDT) &&
+                            string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]))
+                            {
+                            text.erase(text.length()-1);
+                            stem<string_typeT>::update_r_sections(text);
+                            return;
+                            }
+                        }
+                    }
+                return;
+                }
+            else if (!(text.length() >= 3 && is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ) &&
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*baar*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*lijk*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J, common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) )
+                {
+                step_2(text);
+                return;
+                }
+            else if (m_step_2_succeeded &&
+                stem<string_typeT>::delete_if_is_in_r2(text,/*bar*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                return;
+                }
+            }
+        //------------------------------------------------------
+        void step_4(string_typeT& text)
+            {
+            //undouble consecutive (same) consonants
+            if (text.length() >= 4 &&
+                !string_util::is_one_of(text[text.length()-4], DUTCH_VOWELS) &&
+                !string_util::is_one_of(text[text.length()-1], DUTCH_VOWELS) &&
+                text[text.length()-1] != LOWER_I_HASH &&
+                text[text.length()-1] != UPPER_I_HASH &&
+                string_util::is_one_of(text[text.length()-2], L"aeouAEOU") &&
+                string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-3]) )
+                {
+                text.erase(text.end()-2, text.end()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //internal data specific to Dutch stemmer
+        bool m_step_2_succeeded;
+        };
+    }
+
+#endif //__DUTCH_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/english_stem.h b/third-party/OleanderStemmingLibrary/stemming/english_stem.h
new file mode 100644 (file)
index 0000000..ace665a
--- /dev/null
@@ -0,0 +1,1003 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __ENGLISH_STEM_H__
+#define __ENGLISH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+        Language-specific stemming classes.
+    * @{*/
+    /**
+    \class english_stem
+
+    Overview
+
+    I have made more than one attempt to improve the structure of the Porter algorithm 
+    by making it follow the pattern of ending removal of the Romance language stemmers.
+    It is not hard to see why one should want to do this: step 1b of the Porter stemmer 
+    removes ed and ing, which are i-suffixes (*) attached to verbs. If these suffixes are
+    removed, there should be no need to remove d-suffixes which are not verbal, although it
+    will try to do so. This seems to be a deficiency in the Porter stemmer, not shared by
+    the Romance stemmers. Again, the divisions between steps 2, 3 and 4 seem rather arbitrary,
+    and are not found in the Romance stemmers.
+
+    Nevertheless, these attempts at improvement have been abandoned. They seem to lead to a
+    more complicated algorithm with no very obvious improvements. A reason for not taking
+    note of the outcome of step 1b may be that English endings do not determine word categories
+    quite as strongly as endings in the Romance languages. For example, condition and position
+    in French have to be nouns, but in English they can be verbs as well as nouns,
+
+    We are all conditioned by advertising
+    They are positioning themselves differently today
+
+    A possible reason for having separate steps 2, 3 and 4 is that d-suffix combinations in
+    English are quite complex, a point which has been made elsewhere.
+
+    But it is hardly surprising that after twenty years of use of the Porter stemmer, certain
+    improvements do suggest themselves, and a new algorithm for English is therefore offered
+    here. (It could be called the 'Porter2' stemmer to distinguish it from the Porter stemmer,
+    from which it derives.) The changes are not so very extensive: (1) terminating y is changed
+    to i rather less often, (2) suffix us does not lose its s, (3) a few additional suffixes
+    are included for removal, including (4) suffix ly. In addition, a small list of exceptional
+    forms is included. In December 2001 there were two further adjustments: (5) Steps 5a and 5b
+    of the old Porter stemmer were combined into a single step. This means that undoubling final
+    ll is not done with removal of final e. (6) In Step 3 ative is removed only when in region R2. 
+
+    To begin with, here is the basic algorithm without reference to the exceptional forms.
+    An exact comparison with the Porter algorithm needs to be done quite carefully if done at
+    all. Here we indicate by * points of departure, and by + additional features.
+    In the sample vocabulary, Porter and Porter2 stem slightly under 5% of words to different forms.
+
+    Dr. Martin Porter
+
+    Define a vowel as one of
+        - a e i o u y 
+
+    Define a double as one of
+        - bb dd ff gg mm nn pp rr tt 
+
+    Define a valid li-ending as one of
+        - c d e g h k m n r t 
+
+    Define a short syllable in a word as either (a) a vowel followed by a non-vowel
+    other than w, x or Y and preceded by a non-vowel, or * (b) a vowel at the beginning
+    of the word followed by a non-vowel.
+
+    So rap, trap, entrap end with a short syllable, and ow, on, at are classed as short syllables.
+    But uproot, bestow, disturb do not end with a short syllable.
+
+    A word is called short if it consists of a short syllable preceded by zero or more consonants.
+    R1 is the region after the first non-vowel following a vowel, or the end of the word if there is no such non-vowel.
+    R2 is the region after the first non-vowel following a vowel in R1, or the end of the word if there is no such non-vowel.
+    If the word has two letters or less, leave it as it is.
+    Otherwise, do each of the following operations,
+    Set initial y, or y after a vowel, to Y, and then establish the regions R1 and R2.
+    
+    \par Algorithm:
+
+    <b>Step 1a:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated:
+            - sses
+                - Replace by ss.
+            - ied+ ies*
+                - Replace by i if preceded by just one letter, otherwise by ie (so ties -> tie, cries -> cri).
+            - s
+                - Delete if the preceding word part contains a vowel not immediately before the s (so gas and this retain the s, gaps and kiwis lose it).
+            - us+ ss
+                - Do nothing.
+
+    <b>Step 1b:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated:
+            - eed eedly+
+                - Replace by ee if in R1.
+            - ed edly+ ing ingly+
+                - Delete if the preceding word part contains a vowel, and then 
+                - If the word ends at, bl or iz add e (so luxuriat -> luxuriate), or 
+                - If the word ends with a double remove the last letter (so hopp -> hop), or 
+                - If the word is short, add e (so hop -> hope).
+
+    <b>Step 1c:</b>
+
+    Replace suffix y or Y by i if preceded by a non-vowel which is
+    not the first letter of the word (so cry -> cri, by -> by, say -> say)
+
+    <b>Step 2:</b>
+
+    Search for the longest among the following suffixes, and, if found and in R1, perform the action indicated:
+            - tional
+                - Replace by tion.
+            - enci
+                - Replace by ence.
+            - anci
+                - Replace by ance 
+            - abli
+                - Replace by able.
+            - entli
+                - Replace by ent.
+            - izer   ization
+                - Replace by ize.
+            - ational   ation   ator
+                - Replace by ate.
+            - alism   aliti   alli
+                - Replace by al.
+            - fulness
+                - Replace by ful.
+            - ousli   ousness
+                - Replace by ous.
+            - iveness   iviti
+                - Replace by ive.
+            - biliti   bli+
+                - Replace by ble. 
+            - ogi+
+                - Replace by og if preceded by l.
+            - fulli+
+                - Replace by ful.
+            - lessli+
+                - Replace by less.
+            - li+
+                - Delete if preceded by a valid li-ending.
+
+    <b>Step 3:</b>
+
+    Search for the longest among the following suffixes, and, if found and in R1, perform the action indicated:
+            - tional+
+                - Replace by tion.
+            - ational+
+                - Replace by ate.
+            - alize
+                - Replace by al.
+            - icate iciti   ical
+                - Replace by ic.
+            - ful ness
+                - Delete.
+            - ative*
+                - Delete if in R2.
+
+    <b>Step 4:</b>
+
+    Search for the longest among the following suffixes, and, if found and in R2, perform the action indicated:
+            - al ance ence er ic able ible ant ement ment ent ism ate iti ous ive ize 
+                - Delete 
+            - ion 
+                - Delete if preceded by s or t.
+
+    <b>Step 5:</b>
+
+    Search for the following suffixes, and, if found, perform the action indicated:
+            - e 
+                - Delete if in R2, or in R1 and not preceded by a short syllable.
+            - l 
+                - Delete if in R2 and preceded by l.
+    */
+    /** @} */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class english_stem : public stem<string_typeT>
+        {
+    public:
+        english_stem() : m_first_vowel(string_typeT::npos)
+            {}
+        //---------------------------------------------
+        /**@param[in,out] text English string to stem.*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                return;
+                }
+
+            //reset internal data
+            m_first_vowel = string_typeT::npos;
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //handle exceptions first
+            if (is_exception(text) )
+                {
+                return;
+                }
+
+            stem<string_typeT>::hash_y(text, L"aeiouyAEIOUY");
+            m_first_vowel = text.find_first_of(L"aeiouyAEIOUY");
+            if (m_first_vowel == string_typeT::npos)
+                { return; }
+
+            if (text.length() >= 5 &&
+                /*gener*/
+                (is_either<wchar_t>(text[0], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                stem<string_typeT>::set_r1(5);
+                }
+            else if (text.length() >= 6 &&
+                /*commun*/
+                (is_either<wchar_t>(text[0], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ) )
+                {
+                stem<string_typeT>::set_r1(6);
+                }
+                       else if (text.length() >= 5 &&
+                /*arsen*/
+                (is_either<wchar_t>(text[0], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ) )
+                {
+                stem<string_typeT>::set_r1(5);
+                }
+            else
+                {
+                stem<string_typeT>::find_r1(text, L"aeiouyAEIOUY");
+                }
+
+            stem<string_typeT>::find_r2(text, L"aeiouyAEIOUY");
+
+            //step 1a:
+            step_1a(text);
+            //exception #2
+            if (is_exception_post_step1a(text) )
+                {
+                return;
+                }
+            //step 1b:
+            step_1b(text);
+            //step 1c:
+            step_1c(text);
+            //step 2:
+            step_2(text);
+            //step 3:
+            step_3(text);
+            //step 4:
+            step_4(text);
+            //step 5:
+            step_5(text);
+
+            stem<string_typeT>::unhash_y(text);
+            }
+    private:
+        //---------------------------------------------
+        bool is_exception(string_typeT& text)
+            {
+            //exception #0
+            /*skis*/
+            if (text.length() == 4 &&
+                is_either<wchar_t>(text[0], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                is_either<wchar_t>(text[1], common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) &&
+                is_either<wchar_t>(text[2], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                is_either<wchar_t>(text[3], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text = L"ski";
+                return true;
+                }
+            /*skies*/
+            else if (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text = L"sky";
+                return true;
+                }
+            /*dying*/
+            else if (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                text = L"die";
+                return true;
+                }
+            /*lying*/
+            else if (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                text = L"lie";
+                return true;
+                }
+            /*tying*/
+            else if (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                text = L"tie";
+                return true;
+                }
+            /*idly*/
+            else if (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"idl";
+                return true;
+                }
+            /*gently*/
+            else if (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"gentl";
+                return true;
+                }
+            /*ugly*/
+            else if (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"ugli";
+                return true;
+                }
+            /*early*/
+            else if (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"earli";
+                return true;
+                }
+            /*only*/
+            else if (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"onli";
+                return true;
+                }
+            /*singly*/
+            else if (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"singl";
+                return true;
+                }
+            //exception #1
+            else if (
+                /*sky*/
+                (text.length() == 3 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) ) ||
+                /*news*/
+                (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_W, common_lang_constants::UPPER_W) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) ||
+                /*howe*/
+                (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_W, common_lang_constants::UPPER_W) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ) ||
+                /*atlas*/
+                (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) ||
+                /*cosmos*/
+                (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) ||
+                /*bias*/
+                (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_B, common_lang_constants::UPPER_B) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) ||
+                /*andes*/
+                (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) )
+                {
+                return true;
+                }
+            return false;
+            }
+
+        //---------------------------------------------
+        bool is_exception_post_step1a(string_typeT& text)
+            {
+            //exception #2
+            if (/*inning*/
+                (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ) ||
+                /*outing*/
+                (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ) ||
+                /*canning*/
+                (text.length() == 7 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[6], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ) ||
+                /*herring*/
+                (text.length() == 7 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[6], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ) ||
+                /*earring*/
+                (text.length() == 7 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[6], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ) ||
+                /*proceed*/
+                (text.length() == 7 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[6], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ) ||
+                /*exceed*/
+                (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_X, common_lang_constants::UPPER_X) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ) ||
+                /*succeed*/
+                (text.length() == 7 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[6], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ) )
+                {
+                return true;
+                }
+            return false;
+            }
+        //---------------------------------------------
+        void step_1a(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*sses*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ied*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ||
+                    stem<string_typeT>::is_suffix(text,/*ies*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() == 3 || text.length() == 4)
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 2 &&
+                    is_either<wchar_t>(text[text.length()-1], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    m_first_vowel < text.length()-2 &&
+                    !string_util::is_one_of(text[text.length()-2], L"suSU") )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_1b(string_typeT& text)
+            {
+            //if the preceding word contains a vowel
+            bool regress_trim = false;
+
+            if (stem<string_typeT>::is_suffix(text,/*eed*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-3)
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*eedly*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ed*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                m_first_vowel < text.length()-2)
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                regress_trim = true;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*edly*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                m_first_vowel < text.length()-4)
+                {
+                text.erase(text.length()-4);
+                stem<string_typeT>::update_r_sections(text);
+                regress_trim = true;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ing*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                m_first_vowel < text.length()-3)
+                {
+                text.erase(text.length()-3);
+                stem<string_typeT>::update_r_sections(text);
+                regress_trim = true;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ingly*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                m_first_vowel < text.length()-5)
+                {
+                text.erase(text.length()-5);
+                stem<string_typeT>::update_r_sections(text);
+                regress_trim = true;
+                }
+            if (regress_trim)
+                {
+                if (stem<string_typeT>::is_suffix(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                    stem<string_typeT>::is_suffix(text,/*bl*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::is_suffix(text,/*iz*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z) )
+                    {
+                    text += common_lang_constants::LOWER_E;
+                    //need to search for r2 again because the 'e' added here may change that
+                    stem<string_typeT>::find_r2(text, L"aeiouyAEIOUY");
+                    }
+                else if (stem<string_typeT>::is_suffix(text,/*bb*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B) ||
+                        stem<string_typeT>::is_suffix(text,/*dd*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ||
+                        stem<string_typeT>::is_suffix(text,/*ff*/common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_F, common_lang_constants::UPPER_F) ||
+                        stem<string_typeT>::is_suffix(text,/*gg*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ||
+                        stem<string_typeT>::is_suffix(text,/*mm*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ||
+                        stem<string_typeT>::is_suffix(text,/*nn*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                        stem<string_typeT>::is_suffix(text,/*pp*/common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) ||
+                        stem<string_typeT>::is_suffix(text,/*rr*/common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ||
+                        stem<string_typeT>::is_suffix(text,/*tt*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (is_short_word(text, text.length() ) )
+                    {
+                    text += common_lang_constants::LOWER_E;
+                    //need to search for r2 again because the 'e' added here may change that
+                    stem<string_typeT>::find_r2(text, L"aeiouyAEIOUY");
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_1c(string_typeT& text)
+            {
+            //proceeding consonant cannot be first letter in word
+            if (text.length() > 2 &&
+                !is_vowel(text[text.length()-2]) )
+                {
+                if (is_either<wchar_t>(text[text.length()-1], common_lang_constants::LOWER_Y, LOWER_Y_HASH) )
+                    {
+                    text[text.length()-1] = common_lang_constants::LOWER_I;
+                    }
+                else if (is_either<wchar_t>(text[text.length()-1], common_lang_constants::UPPER_Y, UPPER_Y_HASH) )
+                    {
+                    text[text.length()-1] = common_lang_constants::UPPER_I;
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (text.length() >= 7 &&
+                               (stem<string_typeT>::is_suffix(text,/*ization*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                               stem<string_typeT>::is_suffix(text,/*ational*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-7)
+                    {
+                    text.erase(text.length()-4);
+                    text[static_cast<int>(text.length()-1)] = common_lang_constants::LOWER_E;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 7 &&
+                               (stem<string_typeT>::is_suffix(text,/*fulness*/common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                               stem<string_typeT>::is_suffix(text,/*ousness*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                               stem<string_typeT>::is_suffix(text,/*iveness*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-7)
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 6 &&
+                               (stem<string_typeT>::is_suffix(text,/*tional*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                               stem<string_typeT>::is_suffix(text,/*lessli*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-6)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 6 && stem<string_typeT>::is_suffix(text,/*biliti*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-6)
+                    {
+                    text.erase(text.length()-3);
+                    text[text.length()-2] = common_lang_constants::LOWER_L;
+                    text[text.length()-1] = common_lang_constants::LOWER_E;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 5 &&
+                               (stem<string_typeT>::is_suffix(text,/*iviti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*ation*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-2);
+                    text[text.length()-1] = common_lang_constants::LOWER_E;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 5 &&
+                               (stem<string_typeT>::is_suffix(text,/*alism*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ||
+                               stem<string_typeT>::is_suffix(text,/*aliti*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 5 &&
+                               (stem<string_typeT>::is_suffix(text,/*ousli*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*entli*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*fulli*/common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 && stem<string_typeT>::is_suffix(text,/*alli*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 &&
+                               (stem<string_typeT>::is_suffix(text,/*enci*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*anci*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*abli*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text[text.length()-1] = common_lang_constants::LOWER_E;
+                    }
+                }
+            else if (text.length() >= 4 && stem<string_typeT>::is_suffix(text,/*izer*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 && stem<string_typeT>::is_suffix(text,/*ator*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-1);
+                    text[text.length()-1] = common_lang_constants::LOWER_E;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 3 &&
+                stem<string_typeT>::get_r1() <= (text.length()-3) &&
+                stem<string_typeT>::is_suffix(text,/*bli*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                text[text.length()-1] = common_lang_constants::LOWER_E;
+                }
+            else if (text.length() >= 3 &&
+                stem<string_typeT>::get_r1() <= (text.length()-3) &&
+                stem<string_typeT>::is_suffix(text,/*ogi*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 2 &&
+                    stem<string_typeT>::get_r1() <= (text.length()-2) &&
+                    stem<string_typeT>::is_suffix(text,/*li*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (string_util::is_one_of(text[text.length()-3], L"cdeghkmnrtCDEGHKMNRT") )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text) 
+            {
+            if (text.length() >= 7 && stem<string_typeT>::is_suffix(text,/*ational*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-7)
+                    {
+                    text.erase(text.length()-4);
+                    text[text.length()-1] = common_lang_constants::LOWER_E;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 6 && stem<string_typeT>::is_suffix(text,/*tional*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-6)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 5 &&
+                               (stem<string_typeT>::is_suffix(text,/*icate*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                               stem<string_typeT>::is_suffix(text,/*iciti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*alize*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 5 && stem<string_typeT>::is_suffix(text,/*ative*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 && stem<string_typeT>::is_suffix(text,/*ical*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 && stem<string_typeT>::is_suffix(text,/*ness*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 3 && stem<string_typeT>::is_suffix(text,/*ful*/common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_4(string_typeT& text)
+            {
+            if (text.length() >= 5 &&
+                stem<string_typeT>::is_suffix(text,/*ement*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 &&
+                    (stem<string_typeT>::is_suffix(text,/*able*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_suffix(text,/*ible*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_suffix(text,/*ment*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                    stem<string_typeT>::is_suffix(text,/*ence*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_suffix(text,/*ance*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E)) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 &&
+                    (stem<string_typeT>::is_suffix(text,/*sion*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                    stem<string_typeT>::is_suffix(text,/*tion*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N)) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 3 &&
+                    (stem<string_typeT>::is_suffix(text,/*ant*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                    stem<string_typeT>::is_suffix(text,/*ent*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                    stem<string_typeT>::is_suffix(text,/*ism*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ||
+                    stem<string_typeT>::is_suffix(text,/*ate*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_suffix(text,/*iti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::is_suffix(text,/*ous*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                    stem<string_typeT>::is_suffix(text,/*ive*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_suffix(text,/*ize*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E)) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 2 &&
+                    (stem<string_typeT>::is_suffix(text,/*al*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::is_suffix(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ||
+                    stem<string_typeT>::is_suffix(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C)) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_5(string_typeT& text)
+            {
+            if (text.length() >= 1 &&
+                is_either<wchar_t>(text[text.length()-1], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::get_r2() != text.length())
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (stem<string_typeT>::get_r1() != text.length() &&
+                    text.length() >= 2 &&
+                    //look at the part of the word in front of the last 'e' to see if it ends with
+                    //a short syllable.
+                    !ends_with_short_syllable(text, text.length()-1))
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (stem<string_typeT>::get_r2() != text.length() &&
+                stem<string_typeT>::is_suffix(text,/*ll*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        /**Define a short syllable in a word as either
+        (a) a vowel followed by a non-vowel other than w, x or Y and preceded by a non-vowel, or 
+        (b) a vowel at the beginning of the word followed by a non-vowel.
+
+        So rap, trap, entrap end with a short syllable, and ow, on, at are classed as short syllables.
+        But uproot, bestow, disturb do not end with a short syllable.*/
+        //---------------------------------------------
+        bool ends_with_short_syllable(const string_typeT& text, const size_t length) const
+            {
+            if (length == 2)
+                {
+                if (is_vowel(text[0]) )
+                    { return (!is_vowel(text[1]) ); }
+                else
+                    { return false; }
+                }
+            else if (length > 2)
+                {
+                size_t start = text.find_last_of(L"aeiouyAEIOUY", length-1);
+                if (start == string_typeT::npos)
+                    { return false; }
+                if (start > 0 &&
+                    start == (length-2) &&
+                    //following letter
+                    (!is_vowel(text[start+1]) &&
+                    !string_util::is_one_of(text[start+1], L"wxWX") &&
+                    is_neither(text[start+1], LOWER_Y_HASH, UPPER_Y_HASH)) &&
+                    //proceeding letter
+                    !is_vowel(text[start-1]) )
+                    { return true; }
+                else
+                    { return false; }
+                }
+            else
+                { return false; }
+            }
+        ///A word is called short if it ends in a short syllable, and if R1 is null.
+        //---------------------------------------------
+        inline bool is_short_word(const string_typeT& text, const size_t length) const
+            { return (ends_with_short_syllable(text, length) && stem<string_typeT>::get_r1() == text.length()); }
+        //---------------------------------------------
+        inline bool is_vowel(const wchar_t character) const
+            { return (string_util::is_one_of(character, L"aeiouyAEIOUY") ); }
+
+        size_t m_first_vowel;
+        };
+    }
+
+#endif //__ENGLISH_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/finnish_stem.h b/third-party/OleanderStemmingLibrary/stemming/finnish_stem.h
new file mode 100644 (file)
index 0000000..5f1b87a
--- /dev/null
@@ -0,0 +1,546 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __FINNISH_STEM_H__
+#define __FINNISH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class finnish_stem
+        Finnish stemming class.
+
+    Finnish is not an Indo-European language, but belongs to the Finno-Ugric group,
+    which again belongs to the Uralic group. Distinctions between a-, i- and d-suffixes
+    can be made in Finnish, but they are much less sharply separated than in an
+    Indo-European language. The system of endings is extremely elaborate, but strictly
+    defined, and applies equally to all nominals, that is, to nouns, adjectives and pronouns.
+    Verb endings have a close similarity to nominal endings, which again makes Finnish
+    very different from any Indo-European language.
+
+    More problematical than the endings themselves is the change that can be effected in a
+    stem as a result of taking a particular ending. A stem typically has two forms
+    ,strong and weak, where one class of ending follows the strong form and the complementary
+    class the weak. Normalising strong and weak forms after ending removal is not generally possible,
+    although the common case where strong and weak forms only differ in the single or double form of
+    a final consonant can be dealt with.
+
+    Finnish includes the following accented forms:
+        - ä ö
+
+    The following letters are vowels:
+        - a e i o u y ä ö
+
+    R1 and R2 are then defined in the usual way.
+
+    \par Algorithm:
+
+    <b>Step 1 (particles etc.):</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated:
+
+    - kin kaan kään ko kö han hän pa pä
+        - Delete if preceded by n, t or a vowel.
+    - sti
+        - Delete if in R2.
+        (Of course, the n, t or vowel of 1(a) need not be in R1:
+        only the suffix removed must be in R1. And similarly below.
+
+    <b>Step 2 (possessives):</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated:
+
+    - si
+        - Delete if not preceded by k.
+    - ni
+        - Delete. If preceded by kse, replace with ksi.
+    - nsa nsä mme nne
+        - Delete.
+    - an
+        - Delete if preceded by one of:   ta   ssa   sta   lla   lta   na.
+    - än
+        - Delete if preceded by one of: tä ssä stä llä ltä nä.
+    - en
+        - Delete if preceded by one of:   lle   ine.
+
+    <b>Step 3 (cases):</b>
+
+    Define a v (vowel) as one of:
+        - a   e   i   o   u   y   ä ö.
+
+    Define a V (restricted vowel) as one of:
+        - a   e   i   o   u   ä ö.
+
+    So Vi means a V followed by letter i.
+
+    Define LV (long vowel) as one of:
+        - aa   ee   ii   oo   uu   ää öö.
+
+    Define a c (consonant) as a character other than a v.
+    So cv means a c followed by a v.
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated:
+
+    - hXn   (preceded by X, where X is a V, other than u [a/han, e/hen etc]) 
+    - siin   den   tten   (preceded by Vi)
+    - seen   (preceded by LV)
+    - a ä    (preceded by cv)
+    - tta   ttä   (preceded by e)
+    - ta   tä   ssa   ssä   sta   stä   lla   llä   lta   ltä   lle   na   nä   ksi   ine
+        - Delete.
+    - n
+        - Delete, and if preceded by LV or ie, delete the last vowel.
+
+    <b>Step 4 (other endings):</b>
+
+    Search for the longest among the following suffixes in R2, and perform the action indicated:
+
+    - mpi   mpa   mpä   mmi   mma   mmä
+        - Delete if not preceded by po.
+    - impi   impa   impä   immi   imma   immä   eja   ejä 
+        - Delete.
+
+    <b>Step 5 (plurals): </b>
+
+    If an ending was removed in step 3, delete a final 'i' or 'j' if in R1;
+    otherwise, if an ending was not removed in step 3,
+    then delete the final 't' in R1 if it follows a vowel, and, if a 't' is removed,
+    then delete a final "mma" or "imma" in R2, unless the "mma" is preceded by "po".
+
+    <b>Step 6 (tidying up):</b>
+
+    Perform steps (a), (b), (c), (d), restricting all tests to the R1 region.
+
+    <b>Step 6(a):</b>
+
+    If R1 ends with LV then delete the last letter.
+
+    <b>Step 6(b):</b>
+
+    If R1 ends with cX, c a consonant and X one of:
+    - a   ä   e   i
+        -Delete the last letter.
+
+    <b>Step 6(c):</b>
+
+    If R1 ends with oj or uj, then delete the last letter.
+
+    <b>Step 6(d):</b>
+
+    If R1 ends with jo then, delete the last letter.
+
+    <b>Step 6(e):</b>
+
+    This is not restricted to R1. If the word ends with a double consonant followed by zero or more vowels,
+    then remove the last consonant (so eläkk -> eläk, aatonaatto -> aatonaato).
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class finnish_stem : public stem<string_typeT>
+        {
+    public:
+        finnish_stem() : m_step_3_successful(false) {}
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 2)
+                {
+                return;
+                }
+
+            //reset internal data
+            m_step_3_successful = false;
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            stem<string_typeT>::find_r1(text, FINNISH_VOWELS);
+            stem<string_typeT>::find_r2(text, FINNISH_VOWELS);
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+            step_4(text);
+            step_5(text);
+            step_6(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*kaan*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*kään*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (text.length() >= 5 &&
+                    string_util::is_one_of(text[text.length()-5], FINNISH_STEP_1_SUFFIX) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*kin*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*han*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hän*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (text.length() >= 4 &&
+                    string_util::is_one_of(text[text.length()-4], FINNISH_STEP_1_SUFFIX) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*sti*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text,/*sti*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*ko*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*kö*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_O_UMLAUTS, common_lang_constants::UPPER_O_UMLAUTS) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*pa*/common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*pä*/common_lang_constants::LOWER_P, common_lang_constants::UPPER_P,common_lang_constants:: LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) )
+                {
+                if (text.length() >= 3 &&
+                    string_util::is_one_of(text[text.length()-3], FINNISH_STEP_1_SUFFIX) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*nsa*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*nsä*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*mme*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*nne*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*si*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (text.length() >= 3 &&
+                    !(text[text.length()-3] == common_lang_constants::LOWER_K || text[text.length()-3] == common_lang_constants::UPPER_K))
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ni*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text, /*kse*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text[text.length()-1] = common_lang_constants::LOWER_I;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*an*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if ((text.length() >= 4 &&
+                    (stem<string_typeT>::is_partial_suffix(text, (text.length()-4), common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-4), common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A)) ) ||
+                    (text.length() >= 5 &&
+                    (stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ) ) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*än*/common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if ((text.length() >= 4 &&
+                    (stem<string_typeT>::is_partial_suffix(text, (text.length()-4), common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-4), common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS)) ) ||
+                    (text.length() >= 5 &&
+                    (stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ) ) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (text.length() >= 5 &&
+                    (stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text)
+            {
+            //seen followed by LV
+            if (text.length() >= 6 &&
+                stem<string_typeT>::is_suffix_in_r1(text,/*seen*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                string_util::is_one_of(text[text.length()-5], FINNISH_VOWELS_NO_Y) &&
+                string_util::tolower_western(text[text.length()-5]) == string_util::tolower_western(text[text.length()-6]) )
+                {
+                text.erase(text.length()-4);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_3_successful = true;
+                return;
+                }
+            //suffix followed by Vi
+            else if (text.length() >= 6 &&
+                    is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    (stem<string_typeT>::is_suffix_in_r1(text,/*siin*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                    stem<string_typeT>::is_suffix_in_r1(text,/*tten*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ) &&
+                    string_util::is_one_of(text[text.length()-6], FINNISH_VOWELS_NO_Y) )
+                {
+                text.erase(text.length()-4);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_3_successful = true;
+                return;
+                }
+            //suffix followed by Vi
+            else if (text.length() >= 5 &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    stem<string_typeT>::is_suffix_in_r1(text,/*den*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    string_util::is_one_of(text[text.length()-5], FINNISH_VOWELS_NO_Y) )
+                {
+                text.erase(text.length()-3);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_3_successful = true;
+                return;
+                }
+            else if ((stem<string_typeT>::is_suffix_in_r1(text,/*tta*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*ttä*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS)) &&
+                is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                text.erase(text.length()-3);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_3_successful = true;
+                return;
+                }
+            //ends if VHVN
+            else if (
+                (stem<string_typeT>::is_suffix_in_r1(text,/*han*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hen*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hin*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hon*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hän*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hön*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_O_UMLAUTS, common_lang_constants::UPPER_O_UMLAUTS, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ) )
+                {
+                if (string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-4]) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_3_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ssa*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*ssä*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*sta*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*stä*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*lla*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*llä*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*lta*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*ltä*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*lle*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*ksi*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*ine*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*na*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*nä*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) )
+                {
+                m_step_3_successful = true;
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ta*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*tä*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) )
+                {
+                m_step_3_successful = true;
+                return;
+                }
+            //suffix followed by cv
+            else if (text.length() >= 3 &&
+                    (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) || stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ) &&
+                    !string_util::is_one_of(text[text.length()-3], FINNISH_VOWELS) &&
+                    string_util::is_one_of(text[text.length()-2], FINNISH_VOWELS) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_3_successful = true;
+                return;
+                }
+            //suffix followed by LV or ie
+            else if (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                if (text.length() >= 2 &&
+                    ((string_util::is_one_of(text[text.length()-1], FINNISH_VOWELS_NO_Y) &&
+                      string_util::tolower_western(text[text.length()-1]) == string_util::tolower_western(text[text.length()-2])) ||
+                     stem<string_typeT>::is_suffix_in_r1(text,/*ie*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E)) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                m_step_3_successful = true;
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_4(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r2(text,/*impi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*impa*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*impä*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*immi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*imma*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*immä*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*eja*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ejä*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) )
+                {
+                return;
+                }
+            else if (text.length() >= 5 &&
+                    (stem<string_typeT>::is_suffix_in_r2(text,/*mpi*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::is_suffix_in_r2(text,/*mpa*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_suffix_in_r2(text,/*mpä*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ||
+                    stem<string_typeT>::is_suffix_in_r2(text,/*mmi*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::is_suffix_in_r2(text,/*mma*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_suffix_in_r2(text,/*mmä*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ) )
+                {
+                if (!(is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            return;
+            }
+        //---------------------------------------------
+        void step_5(string_typeT& text)
+            {
+            //if step 3 was successful in removing a suffix
+            if (m_step_3_successful)
+                {
+                if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J) )
+                    {
+                    //NOOP
+                    }
+                }
+            else
+                {
+                if (text.length() >= 2 &&
+                    string_util::is_one_of(text[text.length()-2], FINNISH_VOWELS) )
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                        {
+                        if (!stem<string_typeT>::delete_if_is_in_r2(text,/*imma*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                            {
+                            if (text.length() >= 5 &&
+                                stem<string_typeT>::is_suffix_in_r2(text,/*mma*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                                //isn't proceeded by "po"
+                                !(is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) &&
+                                is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                                {
+                                text.erase(text.length()-3);
+                                stem<string_typeT>::update_r_sections(text);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_6(string_typeT& text)
+            {
+            step_6a(text);
+            step_6b(text);
+            step_6c(text);
+            step_6d(text);
+            step_6e(text);
+            }
+        //---------------------------------------------
+        void step_6a(string_typeT& text)
+            {
+            if (text.length() >= 2 &&
+                stem<string_typeT>::get_r1() <= text.length()-2 &&
+                string_util::is_one_of(text[text.length()-1], FINNISH_VOWELS_NO_Y) &&
+                string_util::tolower_western(text[text.length()-1]) == string_util::tolower_western(text[text.length()-2]))
+                {
+                text.erase(text.end()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_6b(string_typeT& text)
+            {
+            if (text.length() >= 2 &&
+                stem<string_typeT>::get_r1() <= text.length()-2 &&
+                !string_util::is_one_of(text[text.length()-2], FINNISH_VOWELS) &&
+                string_util::is_one_of(text[text.length()-1], FINNISH_VOWELS_SIMPLE) )
+                {
+                text.erase(text.end()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_6c(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*oj*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*uj*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J) )
+                {
+                text.erase(text.end()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_6d(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*jo*/common_lang_constants::LOWER_J, common_lang_constants::UPPER_J, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                text.erase(text.end()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_6e(string_typeT& text)
+            {
+            //find the last consonant
+            size_t index = text.find_last_not_of(FINNISH_VOWELS);
+            if (index == string_typeT::npos ||
+                index < 1)
+                { return; }
+            if (string_util::tolower_western(text[index]) == string_util::tolower_western(text[index-1]))
+                {
+                text.erase(text.begin()+(index) );
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //internal data specific to Finnish stemmer
+        bool m_step_3_successful;
+        };
+    }
+
+#endif //__FINNISH_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/french_stem.h b/third-party/OleanderStemmingLibrary/stemming/french_stem.h
new file mode 100644 (file)
index 0000000..1d2ae03
--- /dev/null
@@ -0,0 +1,1397 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __FRENCH_STEM_H__
+#define __FRENCH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class french_stem
+        French stemming class.
+
+
+    Letters in French include the following accented forms:
+        - â à ç ë é ê è ï î ô û ù 
+
+    The following letters are vowels:
+        - a e i o u y â à ë é ê è ï î ô û ù
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated.
+        - ance iqUe isme able iste eux ances iqUes ismes ables istes
+            - Delete if in R2.
+        - atrice ateur ation atrices ateurs ations
+            - Delete if in R2.
+            - If preceded by ic, delete if in R2, else replace by iqU.
+        - logie logies
+            - Replace with log if in R2.
+        - usion ution usions utions
+            - Replace with u if in R2.
+        -ence ences
+            - Replace with ent if in R2.
+        - ement ements
+            - Delete if in RV
+            - If preceded by iv, delete if in R2 (and if further preceded by at, delete if in R2), otherwise,
+            - If preceded by eus, delete if in R2, else replace by eux if in R1, otherwise,
+            - If preceded by abl or iqU, delete if in R2, otherwise,
+        - If preceded by ièr or Ièr, replace by i if in RV
+        - ité ités
+            - Delete if in R2
+            - If preceded by abil, delete if in R2, else replace by abl, otherwise,
+            - If preceded by ic, delete if in R2, else replace by iqU, otherwise,
+            - If preceded by iv, delete if in R2
+            - If ive ifs ives, delete if in R2
+            - If preceded by "at", delete if in R2 (and if further preceded by ic, delete if in R2, else replace by iqU).
+        - eaux
+            - Replace with eau.
+        - aux
+            - Replace with al if in R1.
+        - euse euses
+            - Delete if in R2, else replace by eux if in R1.
+        - issement issements
+            - Delete if in R1 and preceded by a non-vowel.
+        - amment
+            - Replace with ant if in RV.
+        - emment
+            - Replace with ent if in RV.
+        -ment ments
+            - Delete if preceded by a vowel in RV.
+
+    In steps 2(a) and 2(b) all tests are confined to the RV region.
+
+    Do step 2(a) if either no ending was removed by step 1, or if one of endings amment, emment, ment, ments was found.
+
+    <b>Step 2(a):</b>
+
+    Search for the longest among the following suffixes and if found, delete if preceded by a non-vowel:
+
+        - îmes ît îtes i ie ies ir ira irai iraIent irais irait iras irent irez iriez irions irons iront is issaIent
+        issais issait issant issante issantes issants isse issent isses issez issiez issions issons it
+
+    (Note that the non-vowel itself must also be in RV).
+
+    Do step 2b if step 2a was done, but failed to remove a suffix.
+
+    <b>Step 2(b):</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated. 
+        - ions
+            - Delete if in R2.
+        - é ée ées és èrent er era erai eraIent erais erait eras erez eriez erions erons eront ez iez
+            - Delete.
+        - âmes ât âtes a ai aIent ais ait ant ante antes ants as asse assent asses assiez assions
+            - Delete.
+            - If preceded by e, delete.
+
+    (Note that the e that may be deleted in this last step must also be in RV).
+
+    If the last step to be obeyed - either step 1, 2a or 2b - altered the word, do step 3.
+
+    <b>Step 3:</b>
+
+    Replace final Y with i or final ç with c.
+
+    Alternatively, if the last step to be obeyed did not alter the word, do step 4.
+
+    <b>Step 4:</b>
+
+    If the word ends s, not preceded by a, i, o, u, è or s, delete it. 
+
+    In the rest of step 4, all tests are confined to the RV region.
+
+    Search for the longest among the following suffixes, and perform the action indicated:
+        - ion
+            - Delete if in R2 and preceded by s or t.
+        - ier ière Ier Ière
+            - Replace with i.
+        - e
+            - Delete.
+        - ë 
+            - If preceded by gu, delete.
+
+    (So note that ion is removed only when it is in R2 - as well as being in RV -
+    and preceded by s or t which must be in RV).
+
+    <b>Step 5:</b>
+
+    If the word ends enn, onn, ett, ell or eill, then delete the last letter.
+
+    <b>Step 6:</b>
+
+    If the words ends with é or è followed by at least one non-vowel, then remove the accent from the 'e'.
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class french_stem : public stem<string_typeT>
+        {
+    public:
+        french_stem() : m_step_1_successful(false) {}
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 2)
+                {
+                return;
+                }
+
+            //reset internal data
+            m_step_1_successful = false;
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+            stem<string_typeT>::hash_french_yui(text, FRENCH_VOWELS);
+
+            stem<string_typeT>::find_r1(text, FRENCH_VOWELS);
+            stem<string_typeT>::find_r2(text, FRENCH_VOWELS);
+            stem<string_typeT>::find_french_rv(text, FRENCH_VOWELS);
+
+            size_t length = text.length();
+            step_1(text);
+            if (!m_step_1_successful)
+                {
+                step_2a(text);
+                }
+            if (length != text.length() )
+                {
+                step_3(text);
+                }
+            else
+                {
+                step_4(text);
+                }
+            step_5(text);
+            step_6(text);
+
+            stem<string_typeT>::unhash_french_yui(text);
+            }
+    private:
+        bool ic_to_iqu(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return true;
+                    }
+                else
+                    {
+                    text.erase(text.length()-2);
+                    text += L"iq";
+                    text += LOWER_U_HASH;
+                    //need to search for r2 again because the 'iq' added here may change that
+                    stem<string_typeT>::find_r2(text, FRENCH_VOWELS);
+                    stem<string_typeT>::find_french_rv(text, FRENCH_VOWELS);
+                    return true;
+                    }
+                }
+            return false;
+            }
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            size_t length = text.length();
+            if (stem<string_typeT>::is_suffix(text,/*issements*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 10 &&
+                    stem<string_typeT>::get_r1() <= (text.length()-9) &&
+                    !string_util::is_one_of(text[text.length()-10], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-9);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*issement*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 9 &&
+                    stem<string_typeT>::get_r1() <= (text.length()-8) &&
+                    !string_util::is_one_of(text[text.length()-9], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-8);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            //7
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*atrices*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (length != text.length() )
+                    {
+                    ic_to_iqu(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            //6
+            else if (stem<string_typeT>::is_suffix(text,/*amment*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (stem<string_typeT>::get_rv() <= (text.length()-6) )
+                    {
+                    text.replace(text.end()-5, text.end(), L"nt");
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*emment*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (stem<string_typeT>::get_rv() <= (text.length()-6) )
+                    {
+                    text.replace(text.end()-5, text.end(), L"nt");
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*logies*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-6) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*atrice*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ateurs*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ations*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (length != text.length() )
+                    {
+                    ic_to_iqu(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*usions*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                    stem<string_typeT>::is_suffix(text,/*utions*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-6) )
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ements*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    }
+                else if (stem<string_typeT>::is_suffix(text,/*eus*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-3)
+                        {
+                        text.erase(text.length()-3);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else if (stem<string_typeT>::get_r1() <= text.length()-3)
+                        {
+                        text[text.length()-1] = common_lang_constants::LOWER_X;
+                        }
+                    }
+                else if (stem<string_typeT>::delete_if_is_in_r2(text,/*abl*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    //NOOP
+                    }
+                else if (text.length() >= 3 &&
+                    (text[text.length()-3] == common_lang_constants::LOWER_I || text[text.length()-3] == common_lang_constants::UPPER_I) &&
+                    (text[text.length()-2] == common_lang_constants::LOWER_Q || text[text.length()-2] == common_lang_constants::UPPER_Q) &&
+                    is_either<wchar_t>(text[text.length()-1], LOWER_U_HASH, UPPER_U_HASH) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-3)
+                        {
+                        text.erase(text.length()-3);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    }
+                else if (stem<string_typeT>::is_suffix_in_rv(text,/*ièr*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E_GRAVE, common_lang_constants::UPPER_E_GRAVE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-3) &&
+                    (text[text.length()-2] == common_lang_constants::LOWER_E_GRAVE || text[text.length()-2] == common_lang_constants::UPPER_E_GRAVE) &&
+                    (text[text.length()-1] == common_lang_constants::LOWER_R || text[text.length()-1] == common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[text.length()-3], LOWER_I_HASH, UPPER_I_HASH) )
+                    {
+                    text.replace(text.end()-3, text.end(), L"i");
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            //5
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ateur*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ation*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                if (length != text.length() )
+                    {
+                    ic_to_iqu(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*usion*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                    stem<string_typeT>::is_suffix(text,/*ution*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-5) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ences*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-5) )
+                    {
+                    text.replace(text.end()-3, text.end(), L"t");
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ables*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*istes*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ismes*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ances*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (text.length() >= 5 &&
+                    (text[text.length()-5] == common_lang_constants::LOWER_I || text[text.length()-5] == common_lang_constants::UPPER_I) &&
+                    (text[text.length()-4] == common_lang_constants::LOWER_Q || text[text.length()-4] == common_lang_constants::UPPER_Q) &&
+                    (text[text.length()-2] == common_lang_constants::LOWER_E || text[text.length()-2] == common_lang_constants::UPPER_E) &&
+                    (text[text.length()-1] == common_lang_constants::LOWER_S || text[text.length()-1] == common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[text.length()-3], LOWER_U_HASH, UPPER_U_HASH) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-5)
+                        {
+                        text.erase(text.length()-5);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    if (length != text.length() )
+                        {
+                        m_step_1_successful = true;
+                        }
+                    return;
+                    }
+            else if (stem<string_typeT>::is_suffix(text,/*logie*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-5) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ement*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text, /*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    }
+                else if (stem<string_typeT>::is_suffix(text,/*eus*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                    {
+                    if (text.length() >= 3 &&
+                        stem<string_typeT>::get_r2() <= text.length()-3)
+                        {
+                        text.erase(text.length()-3);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else if (text.length() >= 3 &&
+                        stem<string_typeT>::get_r1() <= text.length()-3)
+                        {
+                        text[text.length()-1] = common_lang_constants::LOWER_X;
+                        }
+                    }
+                else if (stem<string_typeT>::delete_if_is_in_r2(text,/*abl*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    //NOOP
+                    }
+                else if (text.length() >= 3 &&
+                    (text[text.length()-3] == common_lang_constants::LOWER_I || text[text.length()-3] == common_lang_constants::UPPER_I) &&
+                    (text[text.length()-2] == common_lang_constants::LOWER_Q || text[text.length()-2] == common_lang_constants::UPPER_Q) &&
+                    is_either<wchar_t>(text[text.length()-1], LOWER_U_HASH, UPPER_U_HASH) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-3)
+                        {
+                        text.erase(text.length()-3);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    }
+                else if (stem<string_typeT>::is_suffix_in_rv(text,/*ièr*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E_GRAVE, common_lang_constants::UPPER_E_GRAVE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-3) &&
+                    (text[text.length()-2] == common_lang_constants::LOWER_E_GRAVE || text[text.length()-2] == common_lang_constants::UPPER_E_GRAVE) &&
+                    (text[text.length()-1] == common_lang_constants::LOWER_R || text[text.length()-1] == common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[text.length()-3], LOWER_I_HASH, UPPER_I_HASH) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ments*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //the proceeding vowel must also be n RV
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= text.length()-6 &&
+                    string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*euses*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.replace(text.end()-3, text.end(), L"x");
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                m_step_1_successful = true;
+                }
+            //4
+            else if (stem<string_typeT>::is_suffix(text,/*euse*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (text.length() >= 4 &&
+                    stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.replace(text.end()-2, text.end(), L"x");
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                m_step_1_successful = true;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ment*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                //the proceeding vowel must also be n RV
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= text.length()-5 &&
+                    string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ence*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-4) )
+                    {
+                    text.replace(text.end()-2, text.end(), L"t");
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ance*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*isme*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*able*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iste*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (text.length() >= 4 &&
+                    (text[text.length()-4] == common_lang_constants::LOWER_I || text[text.length()-4] == common_lang_constants::UPPER_I) &&
+                    (text[text.length()-3] == common_lang_constants::LOWER_Q || text[text.length()-3] == common_lang_constants::UPPER_Q) &&
+                    (text[text.length()-1] == common_lang_constants::LOWER_E || text[text.length()-1] == common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-2], LOWER_U_HASH, UPPER_U_HASH) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-4)
+                        {
+                        text.erase(text.length()-4);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    if (length != text.length() )
+                        {
+                        m_step_1_successful = true;
+                        }
+                    return;
+                    }
+            else if (stem<string_typeT>::is_suffix(text,/*eaux*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_X, common_lang_constants::UPPER_X) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_1_successful = true;
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ités*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-4)
+                        {
+                        text.erase(text.length()-4);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else
+                        {
+                        text.replace(text.end()-2, text.end(), L"l");
+                        }
+                    }
+                else if (stem<string_typeT>::is_suffix(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-2)
+                        {
+                        text.erase(text.length()-2);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else
+                        {
+                        text.erase(text.length()-2);
+                        text += L"iq";
+                        text += LOWER_U_HASH;
+                        //need to search for r2 again because the 'iq' added here may change that
+                        stem<string_typeT>::find_r2(text, FRENCH_VOWELS);
+                        stem<string_typeT>::find_french_rv(text, FRENCH_VOWELS);
+                        }
+                    }
+                else
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ives*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    ic_to_iqu(text);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            //3
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ité*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-4)
+                        {
+                        text.erase(text.length()-4);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else
+                        {
+                        text.replace(text.end()-2, text.end(), L"l");
+                        }
+                    }
+                else if (stem<string_typeT>::is_suffix(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-2)
+                        {
+                        text.erase(text.length()-2);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else
+                        {
+                        text.erase(text.length()-2);
+                        text += L"iq";
+                        text += LOWER_U_HASH;
+                        //need to search for r2 again because the 'iq' added here may change that
+                        stem<string_typeT>::find_r2(text, FRENCH_VOWELS);
+                        stem<string_typeT>::find_french_rv(text, FRENCH_VOWELS);
+                        }
+                    }
+                else
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*eux*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_X, common_lang_constants::UPPER_X, false) )
+                {
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*aux*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_X, common_lang_constants::UPPER_X) )
+                {
+                if (stem<string_typeT>::get_r1() <= (text.length()-3) )
+                    {
+                    text.replace(text.end()-2, text.end(), L"l");
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ive*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ifs*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                    {
+                    ic_to_iqu(text);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            //2
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*if*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, false) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                    {
+                    ic_to_iqu(text);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            }
+         //---------------------------------------------
+        void step_2a(string_typeT& text)
+            {
+            if (text.length() >= 9 &&
+                stem<string_typeT>::get_rv() <= (text.length()-8) &&
+                (text[text.length()-8] == common_lang_constants::LOWER_I || text[text.length()-8] == common_lang_constants::UPPER_I) &&
+                (text[text.length()-7] == common_lang_constants::LOWER_S || text[text.length()-7] == common_lang_constants::UPPER_S) &&
+                (text[text.length()-6] == common_lang_constants::LOWER_S || text[text.length()-6] == common_lang_constants::UPPER_S) &&
+                (text[text.length()-5] == common_lang_constants::LOWER_A || text[text.length()-5] == common_lang_constants::UPPER_A) &&
+                (text[text.length()-3] == common_lang_constants::LOWER_E || text[text.length()-3] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_N || text[text.length()-2] == common_lang_constants::UPPER_N) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_T || text[text.length()-1] == common_lang_constants::UPPER_T) &&
+                is_either<wchar_t>(text[text.length()-4], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                if (stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-9], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-8);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issantes*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 9 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-9) &&
+                    !string_util::is_one_of(text[text.length()-9], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-8);
+                    return;
+                    }
+                }
+            else if (text.length() >= 8 &&
+                stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                (text[text.length()-7] == common_lang_constants::LOWER_I || text[text.length()-7] == common_lang_constants::UPPER_I) &&
+                (text[text.length()-6] == common_lang_constants::LOWER_R || text[text.length()-6] == common_lang_constants::UPPER_R) &&
+                (text[text.length()-5] == common_lang_constants::LOWER_A || text[text.length()-5] == common_lang_constants::UPPER_A) &&
+                (text[text.length()-3] == common_lang_constants::LOWER_E || text[text.length()-3] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_N || text[text.length()-2] == common_lang_constants::UPPER_N) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_T || text[text.length()-1] == common_lang_constants::UPPER_T) &&
+                is_either<wchar_t>(text[text.length()-4], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                if (stem<string_typeT>::get_rv() <= (text.length()-8) &&
+                    !string_util::is_one_of(text[text.length()-8], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-7);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issante*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (text.length() >= 8 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-8) &&
+                    !string_util::is_one_of(text[text.length()-8], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-7);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issants*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 8 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-8) &&
+                    !string_util::is_one_of(text[text.length()-8], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-7);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issions*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 8 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-8) &&
+                    !string_util::is_one_of(text[text.length()-8], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-7);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irions*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issais*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issait*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issant*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issent*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issiez*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issons*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irais*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irait*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irent*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*iriez*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irons*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*iront*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*isses*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issez*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6)&&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*îmes*/common_lang_constants::LOWER_I_CIRCUMFLEX, common_lang_constants::UPPER_I_CIRCUMFLEX, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*îtes*/common_lang_constants::LOWER_I_CIRCUMFLEX, common_lang_constants::UPPER_I_CIRCUMFLEX, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irai*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*iras*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irez*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*isse*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ies*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 4 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-4) &&
+                    !string_util::is_one_of(text[text.length()-4], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-3);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ira*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (text.length() >= 4 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-4) &&
+                    !string_util::is_one_of(text[text.length()-4], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-3);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text, common_lang_constants::LOWER_I_CIRCUMFLEX, common_lang_constants::UPPER_I_CIRCUMFLEX, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= text.length()-3 &&
+                    !string_util::is_one_of(text[text.length()-3], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-2);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ie*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= text.length()-3 &&
+                    !string_util::is_one_of(text[text.length()-3], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-2);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ir*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= text.length()-3 &&
+                    !string_util::is_one_of(text[text.length()-3], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-2);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*is*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-3) &&
+                    !string_util::is_one_of(text[text.length()-3], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-2);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*it*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-3) &&
+                    !string_util::is_one_of(text[text.length()-3], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-2);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (text.length() >= 2 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-2) &&
+                    !string_util::is_one_of(text[text.length()-2], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-1);
+                    return;
+                    }
+                }
+            //only called if 2a fails to remove a suffix
+            step_2b(text);
+            }
+        //---------------------------------------------
+        void step_2b(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*assions*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assent*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assiez*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (text.length() >= 7 &&
+                stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                (text[text.length()-7] == common_lang_constants::LOWER_E || text[text.length()-7] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-6] == common_lang_constants::LOWER_R || text[text.length()-6] == common_lang_constants::UPPER_R) &&
+                (text[text.length()-5] == common_lang_constants::LOWER_A || text[text.length()-5] == common_lang_constants::UPPER_A) &&
+                (text[text.length()-3] == common_lang_constants::LOWER_E || text[text.length()-3] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_N || text[text.length()-2] == common_lang_constants::UPPER_N) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_T || text[text.length()-1] == common_lang_constants::UPPER_T) &&
+                is_either<wchar_t>(text[text.length()-4], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                text.erase(text.length()-7);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erions*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (text.length() >= 5 &&
+                stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                (text[text.length()-5] == common_lang_constants::LOWER_A || text[text.length()-5] == common_lang_constants::UPPER_A) &&
+                (text[text.length()-3] == common_lang_constants::LOWER_E || text[text.length()-3] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_N || text[text.length()-2] == common_lang_constants::UPPER_N) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_T || text[text.length()-1] == common_lang_constants::UPPER_T) &&
+                is_either<wchar_t>(text[text.length()-4], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                text.erase(text.length()-5);
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*antes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asses*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*èrent*/common_lang_constants::LOWER_E_GRAVE, common_lang_constants::UPPER_E_GRAVE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erais*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erait*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eriez*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erons*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eront*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*ions*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ions*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*âmes*/common_lang_constants::LOWER_A_CIRCUMFLEX, common_lang_constants::UPPER_A_CIRCUMFLEX, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*âtes*/common_lang_constants::LOWER_A_CIRCUMFLEX, common_lang_constants::UPPER_A_CIRCUMFLEX, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ants*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asse*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erai*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eras*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erez*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ais*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ait*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ant*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ées*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*era*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iez*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ât*/common_lang_constants::LOWER_A_CIRCUMFLEX, common_lang_constants::UPPER_A_CIRCUMFLEX, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ai*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*as*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ée*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*és*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ez*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*é*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text)
+            {
+            if (text.length() == 0)
+                { return; }
+            if (text[text.length()-1] == LOWER_Y_HASH)
+                {
+                text[text.length()-1] = common_lang_constants::LOWER_I;
+                }
+            else if (text[text.length()-1] == UPPER_Y_HASH)
+                {
+                text[text.length()-1] = common_lang_constants::UPPER_I;
+                }
+            else if (text[text.length()-1] == common_lang_constants::UPPER_C_CEDILLA)
+                {
+                text[text.length()-1] = common_lang_constants::UPPER_C;
+                }
+            else if (text[text.length()-1] == common_lang_constants::LOWER_C_CEDILLA)
+                {
+                text[text.length()-1] = common_lang_constants::LOWER_C;
+                }
+            }
+        //---------------------------------------------
+        void step_4(string_typeT& text)
+            {
+            if (text.length() >= 2 &&
+                (text[text.length()-1] == common_lang_constants::LOWER_S || text[text.length()-1] == common_lang_constants::UPPER_S) &&
+                !string_util::is_one_of(text[text.length()-2], FRENCH_AIOUES) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+
+            if (stem<string_typeT>::is_suffix_in_rv(text,/*ière*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E_GRAVE, common_lang_constants::UPPER_E_GRAVE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                text.replace(text.end()-4, text.end(), L"i");
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (text.length() >= 4 &&
+                stem<string_typeT>::get_rv() <= (text.length()-4) &&
+                (text[text.length()-3] == common_lang_constants::LOWER_E_GRAVE || text[text.length()-3] == common_lang_constants::UPPER_E_GRAVE) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_R || text[text.length()-2] == common_lang_constants::UPPER_R) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_E || text[text.length()-1] == common_lang_constants::UPPER_E) &&
+                is_either<wchar_t>(text[text.length()-4], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                text.replace(text.end()-4, text.end(), L"i");
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ier*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                text.replace(text.end()-3, text.end(), L"i");
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (text.length() >= 3 &&
+                stem<string_typeT>::get_rv() <= (text.length()-3) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_E || text[text.length()-2] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_R || text[text.length()-1] == common_lang_constants::UPPER_R) &&
+                is_either<wchar_t>(text[text.length()-3], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                text.replace(text.end()-3, text.end(), L"i");
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*sion*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_rv(text,/*tion*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_r2() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ë*/common_lang_constants::LOWER_E_UMLAUTS, common_lang_constants::UPPER_E_UMLAUTS) )
+                {
+                if (text.length() >= 3 &&
+                    (is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[text.length()-2], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) ) )
+                    {
+                    text.erase(text.length()-1);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_5(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*enn*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix(text,/*onn*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix(text,/*ett*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                stem<string_typeT>::is_suffix(text,/*ell*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                stem<string_typeT>::is_suffix(text,/*eill*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_6(string_typeT& text)
+            {
+            size_t last_vowel = text.find_last_of(FRENCH_VOWELS);
+            if (last_vowel == string_typeT::npos ||
+                last_vowel == text.length()-1)
+                {
+                return;
+                }
+            else if (is_either<wchar_t>(text[last_vowel], 0xE9, 0xE8) ||
+                    is_either<wchar_t>(text[last_vowel], 0xC9, 0xC8) )
+                {
+                text[last_vowel] = common_lang_constants::LOWER_E;
+                }
+            }
+
+        //internal data specific to French stemmer
+        bool m_step_1_successful;
+        };
+    }
+
+#endif //__FRENCH_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/german_stem.h b/third-party/OleanderStemmingLibrary/stemming/german_stem.h
new file mode 100644 (file)
index 0000000..c494f7c
--- /dev/null
@@ -0,0 +1,278 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __GERMAN_STEM_H__
+#define __GERMAN_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class german_stem
+        German stemming class.
+
+    German includes the following accented forms,
+    -ä ö ü and a special letter, ß, equivalent to double s.
+
+    The following letters are vowels:
+    -a e i o u y ä ö ü
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes:
+        - e em en ern er es
+        - s (preceded by a valid s-ending)
+    and delete if in R1. (Of course the letter of the valid s-ending is not necessarily in R1).
+
+    (For example, äckern -> äck, ackers -> acker, armes -> arm).
+
+    <b>Step 2:</b>
+
+    Search for the longest among the following suffixes:
+        - en er est
+        - st (preceded by a valid st-ending, itself preceded by at least 3 letters)
+    and delete if in R1.
+
+    (For example, derbsten -> derbst by step 1, and derbst -> derb by step 2,
+    because b is a valid st-ending, and is preceded by just 3 letters).
+
+    <b>Step 3:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated.
+        - end ung
+            - Delete if in R2
+            - If preceded by ig, delete if in R2 and not preceded by e
+
+        - ig ik isch
+            - Delete if in R2 and not preceded by e
+
+        - lich heit
+            - Delete if in R2
+            - If preceded by er or en, delete if in R1
+
+        - keit
+            - Delete if in R2
+            - If preceded by lich or ig, delete if in R2
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class german_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param text string to stem.
+           @param contract_transliterated_umlauts use variant algorithm.
+           that expands "ä" to "ae", ect...*/
+        void operator()(string_typeT& text,
+                        bool contract_transliterated_umlauts = false)
+            {
+            if (text.length() < 2)
+                {
+                stem<string_typeT>::remove_german_umlauts(text);
+                return;
+                }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            stem<string_typeT>::hash_german_yu(text, GERMAN_VOWELS);
+            //change 'ß' to "ss"
+            string_util::replace_all<string_typeT>(text, string_typeT(1, common_lang_constants::ESZETT), L"ss");
+            //German variant addition
+            if (contract_transliterated_umlauts)
+                {
+                string_util::replace_all<string_typeT>(text, L"ae", string_typeT(1, common_lang_constants::LOWER_A_UMLAUTS));
+                string_util::replace_all<string_typeT>(text, L"oe", string_typeT(1, common_lang_constants::LOWER_O_UMLAUTS));
+                //ue to ü, if not in front of 'q'
+                size_t start = 1;
+                while (start != string_typeT::npos)
+                    {
+                    start = text.find(L"ue", start);
+                    if (start == string_typeT::npos ||
+                        is_either<wchar_t>(text[start-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                        {
+                        break;
+                        }
+                    text.replace(start, 2, string_typeT(1, common_lang_constants::LOWER_U_UMLAUTS));
+                    }
+                }
+
+            stem<string_typeT>::find_r1(text, GERMAN_VOWELS);
+            if (stem<string_typeT>::get_r1() == text.length() )
+                {
+                stem<string_typeT>::remove_german_umlauts(text);
+                stem<string_typeT>::unhash_german_yu(text);
+                return;
+                }
+            stem<string_typeT>::find_r2(text, GERMAN_VOWELS);
+            //R1 must have at least 3 characters in front of it
+            if (stem<string_typeT>::get_r1() < 3)
+                {
+                stem<string_typeT>::set_r1(3);    
+                }
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+
+            //unhash special 'u' and 'y' back, and remove the umlaut accent from a, o and u. 
+            stem<string_typeT>::remove_german_umlauts(text);
+            stem<string_typeT>::unhash_german_yu(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*ern*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*em*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                return;
+                }
+            ///Define a valid s-ending as one of b, d, f, g, h, k, l, m, n, r or t.
+            else if (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (string_util::is_one_of(text[text.length()-2], L"bdfghklmnrtBDFGHKLMNRT") )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*est*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                return;
+                }
+            ///Define a valid st-ending as the same list, excluding letter r.
+            else if (text.length() >= 6 &&
+                    stem<string_typeT>::is_suffix_in_r1(text,/*st*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (string_util::is_one_of(text[text.length()-3], L"bdfghklmntBDFGHKLMNT") )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text) 
+            {
+            if (stem<string_typeT>::delete_if_is_in_r2(text,/*heit*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*lich*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ||
+                    stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                    {
+                    return;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*keit*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*lich*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                    {
+                    return;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*isch*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_r2() <= (text.length()-4) &&
+                    is_neither<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*end*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::is_suffix_in_r2(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G)  &&
+                    is_neither<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ung*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::is_suffix_in_r2(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G)  &&
+                    is_neither<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_r2() <= text.length()-2 &&
+                    is_neither<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ik*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_r2() <= text.length()-2 &&
+                    is_neither<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        };
+    }
+
+#endif //__GERMAN_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/italian_stem.h b/third-party/OleanderStemmingLibrary/stemming/italian_stem.h
new file mode 100644 (file)
index 0000000..5cfa118
--- /dev/null
@@ -0,0 +1,900 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __ITALIAN_STEM_H__
+#define __ITALIAN_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class italian_stem
+        Italian stemming class.
+
+    Italian can include the following accented forms:
+        - á é í ó ú à è ì ò ù
+
+    First, replace all acute accents by grave accents.
+    And, as in French, put u after q, and u, i between vowels into upper case. The vowels are then:
+        - a e i o u à è ì ò ù
+
+    R2 and RV have the same definition as in the Spanish stemmer.
+
+    \par Algorithm:
+
+    <b>Step 0:</b>
+
+    Search for the longest among the following suffixes
+        - ci gli la le li lo mi ne si ti vi sene gliela gliele glieli glielo gliene mela
+        mele meli melo mene tela tele teli telo tene cela cele celi celo cene vela vele veli velo vene 
+
+    following one of:
+        - ando endo
+        - ar er ir 
+
+    in RV. In case of (a) the suffix is deleted, in case (b) it is replace by e
+    (guardandogli -> guardando, accomodarci -> accomodare).
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated.
+        - anza   anze   ico   ici   ica   ice   iche   ichi   ismo   ismi   abile   abili   ibile
+         ibili   ista   iste   isti   istà   istè   istì   oso   osi   osa   ose   mente   atrice
+         atrici  ante   anti
+            - Delete if in R2.
+        - azione   azioni   atore   atori delete if in R2
+            - If preceded by ic, delete if in R2.
+        - logia   logie
+            - Replace with log if in R2.
+        - uzione   uzioni   usione   usioni
+            - Replace with u if in R2.
+        - enza   enze
+            - Replace with ente if in R2.
+        - amento   amenti   imento   imenti
+            - Delete if in RV.
+        - amente
+            - Delete if in R1.
+            - If preceded by iv, delete if in R2 (and if further preceded by at, delete if in R2), otherwise,
+            - If preceded by os, ic or abil, delete if in R2.
+        - ità
+            - Delete if in R2.
+            - If preceded by abil, ic or iv, delete if in R2.
+        - ivo   ivi   iva   ive
+            - Delete if in R2.
+            - If preceded by at, delete if in R2 (and if further preceded by ic, delete if in R2).
+
+    Do step 2 if no ending was removed by step 1.
+
+    <b>Step 2:</b>
+    Search for the longest among the following suffixes in RV, and if found, delete.
+        - ammo ando ano are arono asse assero assi assimo ata ate ati ato
+        ava avamo avano avate avi avo emmo enda ende endi endo erà erai
+        eranno ere erebbe erebbero erei eremmo eremo ereste eresti erete
+        erò erono essero ete eva evamo evano evate evi evo Yamo iamo immo 
+        irà irai iranno ire irebbe irebbero irei iremmo iremo ireste iresti
+        irete irò irono isca iscano isce isci isco iscono issero ita ite iti
+        ito iva ivamo ivano ivate ivi ivo ono uta ute uti uto ar ir
+
+    Always do steps 3a and 3b.
+
+    <b>Step 3(a):</b>
+
+    Delete a final a, e, i, o, à, è, ì, or ò if it is in RV, and a preceding 'i'
+    if it is in RV (crocchi -> crocch, crocchio -> crocch).
+
+    <b>Step 3(b):</b>
+
+    Replace final ch (or gh) with c (or g) if in RV (crocch -> crocc).
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class italian_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        ///@param text string to stem
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                stem<string_typeT>::italian_acutes_to_graves(text);
+                return;
+                }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+            stem<string_typeT>::italian_acutes_to_graves(text);
+            stem<string_typeT>::hash_italian_ui(text, ITALIAN_VOWELS);
+
+            stem<string_typeT>::find_r1(text, ITALIAN_VOWELS);
+            stem<string_typeT>::find_r2(text, ITALIAN_VOWELS);
+            stem<string_typeT>::find_spanish_rv(text, ITALIAN_VOWELS);
+
+            //step 0:
+            step_0(text);
+            //step 1:
+            size_t text_length = text.length();
+            step_1(text);
+
+            //step 2 is called only if step 1 did not remove a suffix
+            if (text_length == text.length() )
+                {
+                step_2(text);
+                }
+
+            //step 3:
+            step_3a(text);
+            step_3b(text);
+
+            stem<string_typeT>::unhash_italian_ui(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_0(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*gliela*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 6) || step_0b(text, 6) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*gliele*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 6) || step_0b(text, 6) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*glieli*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 6) || step_0b(text, 6) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*glielo*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 6) || step_0b(text, 6) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*gliene*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 6) || step_0b(text, 6) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*sene*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*mela*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*mele*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*meli*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*melo*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*mene*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*tela*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*tele*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*teli*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*telo*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*tene*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*cela*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*cela*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*celi*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*celo*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*cene*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*vela*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*vele*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*veli*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*velo*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*vene*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*gli*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 3) || step_0b(text, 3) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ci*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*la*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*le*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*li*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*lo*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*mi*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ne*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*si*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ti*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*vi*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            }
+        //---------------------------------------------
+        bool step_0a(string_typeT& text, size_t suffix_length)
+            {
+            if (text.length() >= (suffix_length+4) &&
+                stem<string_typeT>::get_rv() <= text.length()-(4+suffix_length) &&
+                (/*ando*/(is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                        is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                        is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                        is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) ||
+                /*endo*/(is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                        is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                        is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                        is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            return false;
+            }
+        //---------------------------------------------
+        bool step_0b(string_typeT& text, size_t suffix_length)
+            {
+            if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                (
+                /*ar*/(is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) && is_either<wchar_t>(text[text.length()-1-suffix_length], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) ||
+                /*er*/(is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) && is_either<wchar_t>(text[text.length()-1-suffix_length], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) ||
+                /*or*/(is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) && is_either<wchar_t>(text[text.length()-1-suffix_length], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                ) )
+                {
+                text.replace(text.end()-suffix_length, text.end(), L"e");
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            return false;
+            }
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*amento*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ||
+                stem<string_typeT>::delete_if_is_in_rv(text,/*amenti*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                stem<string_typeT>::delete_if_is_in_rv(text,/*imento*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ||
+                stem<string_typeT>::delete_if_is_in_rv(text,/*imenti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*azione*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*azioni*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*uzione*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                stem<string_typeT>::is_suffix_in_r2(text,/*uzioni*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                stem<string_typeT>::is_suffix_in_r2(text,/*usione*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                stem<string_typeT>::is_suffix_in_r2(text,/*usioni*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                text.erase(text.length()-5);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*amente*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    }
+                else if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*os*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                    { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*atrice*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*atrici*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*abile*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*abili*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ibile*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ibili*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*mente*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*atore*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*atori*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*logia*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                stem<string_typeT>::is_suffix_in_r2(text,/*logie*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*enza*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                stem<string_typeT>::is_suffix_in_r2(text,/*enze*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                text.replace(text.end()-2, text.end(), L"te");
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*anti*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*anza*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*anze*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iche*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ichi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ismo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ismi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ista*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iste*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*isti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*istà*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_GRAVE, common_lang_constants::UPPER_A_GRAVE) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*istè*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E_GRAVE, common_lang_constants::UPPER_E_GRAVE) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*istì*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I_GRAVE, common_lang_constants::UPPER_I_GRAVE) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ico*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ici*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ica*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ice*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*oso*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osi*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osa*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ose*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ità*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_GRAVE, common_lang_constants::UPPER_A_GRAVE) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                    { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ivi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*iva*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ive*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*erebbero*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irebbero*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assero*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assimo*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eranno*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erebbe*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eremmo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ereste*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eresti*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*essero*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iranno*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irebbe*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iremmo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ireste*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iresti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iscano*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iscono*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*issero*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arono*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avamo*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avano*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avate*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eremo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erete*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erono*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*evamo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*evano*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*evate*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iremo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irete*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irono*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ivamo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ivano*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ivate*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ammo*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ando*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, /*asse*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assi*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*emmo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*enda*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ende*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*endi*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*endo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erai*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erei*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*yamo*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iamo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*immo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irai*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irei*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isca*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isce*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isci*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isco*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ano*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*are*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ata*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ate*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ati*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ato*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ava*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avi*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avo*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erà*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_GRAVE, common_lang_constants::UPPER_A_GRAVE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ere*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erò*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O_GRAVE, common_lang_constants::UPPER_O_GRAVE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ete*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eva*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*evi*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*evo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irà*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_GRAVE, common_lang_constants::UPPER_A_GRAVE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ire*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irò*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O_GRAVE, common_lang_constants::UPPER_O_GRAVE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ita*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ite*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ito*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iva*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ivi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ivo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ono*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*uta*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ute*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*uti*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*uto*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ar*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            ///'ir' not in original specification, but used in general implementation
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ir*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            /**deletion or 'er' from rv is considered problematic,
+            but part of the standard*/
+            }
+        //---------------------------------------------
+        void step_3a(string_typeT& text)
+            {
+            if (text.length() >= 1 &&
+                stem<string_typeT>::get_rv() <= text.length()-1 &&
+                string_util::is_one_of(text[text.length()-1], ITALIAN_VOWELS_SIMPLE) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                if (stem<string_typeT>::get_rv() <= text.length()-1 &&                    
+                    is_either<wchar_t>(text[text.length()-1], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_3b(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_rv(text,/*ch*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) ||
+                stem<string_typeT>::is_suffix_in_rv(text,/*gh*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        };
+    }
+
+#endif //__ITALIAN_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/norwegian_stem.h b/third-party/OleanderStemmingLibrary/stemming/norwegian_stem.h
new file mode 100644 (file)
index 0000000..903efda
--- /dev/null
@@ -0,0 +1,306 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __NORWEGIAN_STEM_H__
+#define __NORWEGIAN_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class norwegian_stem
+        Norwegian stemming class.
+
+    The Norwegian alphabet includes the following additional letters:
+        - æ   å   ø
+
+    The following letters are vowels:
+        - a   e   i   o   u   y   æ   å   ø
+
+    R2 is not used: R1 is defined in the same way as in the German stemmer.
+
+    Define a valid s-ending as one of
+        - b   c   d   f   g   h   j   l   m   n   o   p   r   t   v   y   z,
+        - or 'k', not preceded by a vowel.
+    
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated: 
+        - a e ede ande ende ane ene hetene en heten ar er heter as es edes
+          endes enes hetenes ens hetens ers ets et het ast 
+            - Delete.
+        - s 
+            - Delete if preceded by a valid s-ending.
+
+        - erte   ert 
+            - Replace with "er".
+
+        (Of course the letter of the valid s-ending is not necessarily in R1).
+
+    <b>Step 2:</b>
+
+    If the word ends dt or vt in R1, then delete the 't'.
+    (For example, meldt -> meld, operativt -> operativ).
+
+    <b>Step 3:</b>
+
+    Search for the longest among the following suffixes in R1, and if found, delete:
+        - leg eleg ig eig lig elig els lov elov slov hetslov
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class norwegian_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                return;
+                }
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::find_r1(text, NORWEGIAN_VOWELS);
+            if (stem<string_typeT>::get_r1() == text.length() )
+                {
+                return;
+                }
+            //R1 must have at least 3 characters in front of it
+            if (stem<string_typeT>::get_r1() < 3)
+                {
+                stem<string_typeT>::set_r1(3);
+                }
+            //norwegian does not use R2
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*hetenes*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*hetene*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*hetens*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heter*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heten*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*endes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ande*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ende*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*edes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*enes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*erte*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ers*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ets*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*het*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ast*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ens*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ene*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ane*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ede*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*ert*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*et*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*as*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ar*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-1)
+                    {
+                    //only delete if a valid "s" ending
+                    if (text.length() >= 2 &&
+                        string_util::is_one_of(text[text.length()-2],
+                        L"bcdfghjlmnoprtvyzBCDFGHJLMNOPRTVYZ") )
+                        {
+                        text.erase(text.length()-1);
+                        stem<string_typeT>::update_r_sections(text);
+                        return;
+                        }
+                    else if (text.length() >= 3 &&
+                        is_either<wchar_t>(text[text.length()-2], common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) &&
+                        !string_util::is_one_of(text[text.length()-3], NORWEGIAN_VOWELS))
+                        {
+                        text.erase(text.length()-1);
+                        stem<string_typeT>::update_r_sections(text);
+                        return;
+                        }
+                    }
+                }
+            }
+
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*dt*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*vt*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*hetslov*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*slov*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*elov*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*elig*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*eleg*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*lov*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*els*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*lig*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*eig*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*leg*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            }
+        };
+    }
+
+#endif //__NORWEGIAN_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/portuguese_stem.h b/third-party/OleanderStemmingLibrary/stemming/portuguese_stem.h
new file mode 100644 (file)
index 0000000..bb11fdd
--- /dev/null
@@ -0,0 +1,1014 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __PORTUGUESE_STEM_H__
+#define __PORTUGUESE_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class portuguese_stem
+        Portuguese stemming class.
+
+    Letters in Portuguese include the following accented forms,
+        - á é í ó ú â ê ô ç ã õ ü ñ
+
+    The following letters are vowels:
+        - a e i o u á é í ó ú â ê ô
+
+    And the two nasalised vowel forms
+     - ã õ
+
+    should be treated as a vowel followed by a consonant. 
+
+    ã and õ are therefore replaced by a~ and o~ in the word, where ~ is a separate character to be treated as a consonant.
+    And then R2 and RV have the same definition as in the Spanish stemmer.
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated.
+        - eza   ezas   ico   ica   icos   icas   ismo   ismos   ável   ível   ista   istas
+         oso   osa   osos   osas   amento   amentos   imento   imentos   adora   ador   aça~o
+         adoras   adores   aço~es   ante   antes   ância
+            - Delete if in R2.
+        - logía logías
+            - Replace with log if in R2.
+        -ución uciones
+            - Replace with u if in R2
+        - ência ências
+            - Replace with ente if in R2.
+        - amente
+            - Delete if in R1.
+            - If preceded by iv, delete if in R2 (and if further preceded by at, delete if in R2), otherwise,
+            - If preceded by os, ic or ad, delete if in R2.
+        -mente
+            - Delete if in R2.
+            - If preceded by ante, avel or ível, delete if in R2.
+        - idade idades
+            - Delete if in R2.
+            - If preceded by abil, ic or iv, delete if in R2.
+        - iva ivo ivas ivos
+            - Delete if in R2.
+            - If preceded by at, delete if in R2.
+        - ira iras
+            - Replace with ir if in RV and preceded by e.
+
+    Do step 2 if no ending was removed by step 1.
+
+    <b>Step 2:</b>
+
+    Search for the longest among the following suffixes in RV, and if found, delete. 
+
+        - ada ida ia aria eria iria ará ara erá era irá ava asse esse isse aste este iste
+        ei arei erei irei am iam ariam eriam iriam aram eram iram avam em arem erem irem
+        assem essem issem ado ido ando endo indo ara~o era~o ira~o ar er ir as adas idas
+        ias arias erias irias arás aras erás eras irás avas es ardes erdes irdes ares eres
+        ires asses esses isses astes estes istes is ais eis íeis aríeis eríeis iríeis áreis
+        areis éreis ereis íreis ireis ásseis ésseis ísseis áveis ados idos ámos amos íamos
+        aríamos eríamos iríamos áramos éramos íramos ávamos emos aremos eremos iremos ássemos
+        êssemos íssemos imos armos ermos irmos eu iu ou ira iras
+
+    If the last step to be obeyed - either step 1 or 2 - altered the word, do step 3.
+
+    <b>Step 3:</b>
+
+    Delete suffix 'i' if in RV and preceded by 'c'.
+    Alternatively, if neither steps 1 nor 2 altered the word, do step 4.
+
+    <b>Step 4:</b>
+    
+    If the word ends with one of the suffixes 
+        - os a i o á í ó 
+
+    in RV, delete it.
+
+    Always do step 5.
+
+    <b>Step 5:</b>
+    
+    If the word ends with one of
+        - e é ê 
+
+    in RV, delete it, and if preceded by gu (or ci) with the u (or i) in RV, delete the u (or i). 
+    Or if the word ends ç remove the cedilla.
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class portuguese_stem : public stem<string_typeT>
+        {
+    public:
+        portuguese_stem() : m_step1_step2_altered(false), m_altered_suffix_index(0)
+            {}
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                return;
+                }
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //reset internal data
+            m_altered_suffix_index = 0;
+            m_step1_step2_altered = false;
+            stem<string_typeT>::reset_r_values();
+
+            string_util::replace_all<string_typeT>(text, string_typeT(1, common_lang_constants::LOWER_A_TILDE), L"a~");
+            string_util::replace_all<string_typeT>(text, string_typeT(1, common_lang_constants::UPPER_A_TILDE), L"A~");
+            string_util::replace_all<string_typeT>(text, string_typeT(1, common_lang_constants::LOWER_O_TILDE), L"o~");
+            string_util::replace_all<string_typeT>(text, string_typeT(1, common_lang_constants::UPPER_O_TILDE), L"O~");
+
+            stem<string_typeT>::find_r1(text, PORTUGUESE_VOWELS);
+            stem<string_typeT>::find_r2(text, PORTUGUESE_VOWELS);
+            stem<string_typeT>::find_spanish_rv(text, PORTUGUESE_VOWELS);
+
+            step_1(text);
+            //intermediate steps handled by step 1
+            if (!m_step1_step2_altered)
+                {
+                step_4(text);
+                }
+            step_5(text);
+
+            //Turn a~, o~ back into ã, õ
+            string_util::replace_all<string_typeT>(text, L"a~", string_typeT(1, common_lang_constants::LOWER_A_TILDE));
+            string_util::replace_all<string_typeT>(text, L"A~", string_typeT(1, common_lang_constants::UPPER_A_TILDE));
+            string_util::replace_all<string_typeT>(text, L"o~", string_typeT(1, common_lang_constants::LOWER_O_TILDE));
+            string_util::replace_all<string_typeT>(text, L"O~", string_typeT(1, common_lang_constants::UPPER_O_TILDE));
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            size_t original_length = text.length();
+            if (stem<string_typeT>::is_suffix_in_r2(text,/*uciones*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-6);
+                m_altered_suffix_index = text.length()-1;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*amentos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*imentos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*amento*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*imento*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*adoras*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*adores*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*aço~es*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_C_CEDILLA, common_lang_constants::UPPER_C_CEDILLA, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::TILDE, common_lang_constants::TILDE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*ências*/common_lang_constants::LOWER_E_CIRCUMFLEX, common_lang_constants::UPPER_E_CIRCUMFLEX, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.replace(text.end()-6, text.end(), L"ente");
+                m_altered_suffix_index = text.length()-4;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*logías*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-3);
+                m_altered_suffix_index = text.length()-3;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*amente*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false);
+                    }
+                else
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r2(text,/*os*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ad*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                        {
+                        //NOOP (fall through to branching statement)
+                        }
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*idades*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }    
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*logía*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                text.erase(text.length()-2);
+                m_altered_suffix_index = text.length()-3;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }    
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*ución*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                text.erase(text.length()-4);
+                m_altered_suffix_index = text.length()-1;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*ência*/common_lang_constants::LOWER_E_CIRCUMFLEX, common_lang_constants::UPPER_E_CIRCUMFLEX, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                text.replace(text.end()-5, text.end(), L"ente");
+                m_altered_suffix_index = text.length()-4;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*mente*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*avel*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ível*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*idade*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*eiras*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_rv() <= text.length()-4)
+                    {
+                    text.erase(text.length()-2);
+                    m_altered_suffix_index = text.length()-3;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*antes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ância*/common_lang_constants::LOWER_A_CIRCUMFLEX, common_lang_constants::UPPER_A_CIRCUMFLEX, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ismos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*istas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*adora*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*aça~o*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_C_CEDILLA, common_lang_constants::UPPER_C_CEDILLA, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::TILDE, common_lang_constants::TILDE, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ezas*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*icos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*icas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ismo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ável*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ível*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ista*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osos*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osas*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ador*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*eira*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (stem<string_typeT>::get_rv() <= text.length()-3)
+                    {
+                    text.erase(text.length()-1);
+                    m_altered_suffix_index = text.length()-3;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*iva*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*eza*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ico*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ica*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*oso*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osa*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            //branch to the next appropriate step
+            if (original_length == text.length() )
+                {
+                step_2(text);
+                }
+            else
+                {
+                m_step1_step2_altered = true;
+                step_3(text);
+                }
+             }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            size_t original_length = text.length();
+
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*aríamos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eríamos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iríamos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ássemos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*êssemos*/common_lang_constants::LOWER_E_CIRCUMFLEX, common_lang_constants::UPPER_E_CIRCUMFLEX, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íssemos*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aríeis*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eríeis*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iríeis*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ásseis*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ésseis*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ísseis*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*áramos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*éramos*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íramos*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ávamos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aremos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eremos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iremos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S ,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ariam*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eriam*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iriam*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assem*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*essem*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*issem*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ara~o*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::TILDE, common_lang_constants::TILDE, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*era~o*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::TILDE, common_lang_constants::TILDE, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ira~o*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::TILDE, common_lang_constants::TILDE, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arias*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erias*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irias*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ardes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erdes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irdes*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asses*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*esses*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isses*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*astes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*estes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*istes*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*áreis*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*areis*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*éreis*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ereis*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íreis*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ireis*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*áveis*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íamos*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*armos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ermos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irmos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aria*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eria*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iria*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asse*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*esse*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isse*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aste*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*este*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iste*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arei*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erei*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irei*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aram*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eram*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iram*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avam*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arem*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erem*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irem*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ando*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*endo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*indo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*adas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*idas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arás*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aras*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erás*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eras*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irás*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ares*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eres*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ires*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íeis*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ados*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*idos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ámos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*amos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*emos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*imos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iras*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ada*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ida*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ará*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ara*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erá*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*era*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irá*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ava*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iam*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ado*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ido*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ias*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ais*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eis*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ira*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ia*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ei*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*am*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*em*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ar*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ir*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*as*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*is*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eu*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iu*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ou*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+
+            if (original_length != text.length() )
+                {
+                m_step1_step2_altered = true;
+                step_3(text);
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text) 
+            {
+            if (stem<string_typeT>::is_suffix(text,/*ci*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                stem<string_typeT>::get_rv() <= text.length()-1)
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_4(string_typeT& text) 
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*os*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE) )
+                {
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_5(string_typeT& text) 
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                if (text.length() >= 1 &&
+                    stem<string_typeT>::get_rv() <= text.length()-1 &&
+                    (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) ||
+                    stem<string_typeT>::is_suffix(text,/*ci*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I)) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*é*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                if (text.length() >= 1 &&
+                    stem<string_typeT>::get_rv() <= text.length()-1 &&
+                    (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) ||
+                    stem<string_typeT>::is_suffix(text,/*ci*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I)) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ê*/common_lang_constants::LOWER_E_CIRCUMFLEX, common_lang_constants::UPPER_E_CIRCUMFLEX, false) )
+                {
+                if (text.length() >= 1 &&
+                    stem<string_typeT>::get_rv() <= text.length()-1 &&
+                    (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) ||
+                    stem<string_typeT>::is_suffix(text,/*ci*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I)) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (text.length() >= 1 &&
+                text[text.length()-1] == common_lang_constants::UPPER_C_CEDILLA)
+                {
+                text[text.length()-1] = common_lang_constants::UPPER_C;
+                }
+            else if (text.length() >= 1 &&
+                text[text.length()-1] == common_lang_constants::LOWER_C_CEDILLA)
+                {
+                text[text.length()-1] = common_lang_constants::LOWER_C;
+                }
+            }
+        //internal data specific to Portuguese stemmer
+        bool m_step1_step2_altered;
+        size_t m_altered_suffix_index;
+        };
+    }
+
+#endif //__PORTUGUESE_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/russian_stem.h b/third-party/OleanderStemmingLibrary/stemming/russian_stem.h
new file mode 100644 (file)
index 0000000..4d1625f
--- /dev/null
@@ -0,0 +1,538 @@
+/**
+\date 2010-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __RUSSIAN_STEM_H__
+#define __RUSSIAN_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    static const wchar_t RUSSIAN_VOWELS[] = { 0x0410, 0x0430, 0x0415, 0x0435, 0x0418, 0x0438,
+                                              0x041E, 0x043E, 0x423, 0x0443, 0x042B, 0x044B,
+                                              0x042D, 0x044D, 0x042E, 0x044E, 0x042F, 0x044F, 0 };
+
+    static const wchar_t RUSSIAN_A_UPPER = 0x0410;
+    static const wchar_t RUSSIAN_A_LOWER = 0x0430;
+
+    static const wchar_t RUSSIAN_BE_UPPER = 0x0411;
+    static const wchar_t RUSSIAN_BE_LOWER = 0x0431;
+
+    static const wchar_t RUSSIAN_VE_UPPER = 0x0412;
+    static const wchar_t RUSSIAN_VE_LOWER = 0x0432;
+
+    static const wchar_t RUSSIAN_GHE_UPPER = 0x0413;
+    static const wchar_t RUSSIAN_GHE_LOWER = 0x0433;
+
+    static const wchar_t RUSSIAN_DE_UPPER = 0x0414;
+    static const wchar_t RUSSIAN_DE_LOWER = 0x0434;
+
+    static const wchar_t RUSSIAN_IE_UPPER = 0x0415;
+    static const wchar_t RUSSIAN_IE_LOWER = 0x0435;
+
+    static const wchar_t RUSSIAN_ZHE_UPPER = 0x0416;
+    static const wchar_t RUSSIAN_ZHE_LOWER = 0x0436;
+
+    static const wchar_t RUSSIAN_ZE_UPPER = 0x0417;
+    static const wchar_t RUSSIAN_ZE_LOWER = 0x0437;
+
+    static const wchar_t RUSSIAN_I_UPPER = 0x0418;
+    static const wchar_t RUSSIAN_I_LOWER = 0x0438;
+
+    static const wchar_t RUSSIAN_SHORT_I_UPPER = 0x0419;
+    static const wchar_t RUSSIAN_SHORT_I_LOWER = 0x0439;
+
+    static const wchar_t RUSSIAN_KA_UPPER = 0x041A;
+    static const wchar_t RUSSIAN_KA_LOWER = 0x043A;
+
+    static const wchar_t RUSSIAN_EL_UPPER = 0x041B;
+    static const wchar_t RUSSIAN_EL_LOWER = 0x043B;
+
+    static const wchar_t RUSSIAN_EM_UPPER = 0x041C;
+    static const wchar_t RUSSIAN_EM_LOWER = 0x043C;
+
+    static const wchar_t RUSSIAN_EN_UPPER = 0x041D;
+    static const wchar_t RUSSIAN_EN_LOWER = 0x043D;
+
+    static const wchar_t RUSSIAN_O_UPPER = 0x041E;
+    static const wchar_t RUSSIAN_O_LOWER = 0x043E;
+
+    static const wchar_t RUSSIAN_PE_UPPER = 0x041F;
+    static const wchar_t RUSSIAN_PE_LOWER = 0x043F;
+
+    static const wchar_t RUSSIAN_ER_UPPER = 0x0420;
+    static const wchar_t RUSSIAN_ER_LOWER = 0x0440;
+
+    static const wchar_t RUSSIAN_ES_UPPER = 0x0421;
+    static const wchar_t RUSSIAN_ES_LOWER = 0x0441;
+
+    static const wchar_t RUSSIAN_TE_UPPER = 0x0422;
+    static const wchar_t RUSSIAN_TE_LOWER = 0x0442;
+
+    static const wchar_t RUSSIAN_U_UPPER = 0x0423;
+    static const wchar_t RUSSIAN_U_LOWER = 0x0443;
+
+    static const wchar_t RUSSIAN_EF_UPPER = 0x0424;
+    static const wchar_t RUSSIAN_EF_LOWER = 0x0444;
+
+    static const wchar_t RUSSIAN_HA_UPPER = 0x0425;
+    static const wchar_t RUSSIAN_HA_LOWER = 0x0445;
+
+    static const wchar_t RUSSIAN_TSE_UPPER = 0x0426;
+    static const wchar_t RUSSIAN_TSE_LOWER = 0x0446;
+
+    static const wchar_t RUSSIAN_CHE_UPPER = 0x0427;
+    static const wchar_t RUSSIAN_CHE_LOWER = 0x0447;
+
+    static const wchar_t RUSSIAN_SHA_UPPER = 0x0428;
+    static const wchar_t RUSSIAN_SHA_LOWER = 0x0448;
+
+    static const wchar_t RUSSIAN_SHCHA_UPPER = 0x0429;
+    static const wchar_t RUSSIAN_SHCHA_LOWER = 0x0449;
+
+    static const wchar_t RUSSIAN_HARD_SIGN_UPPER = 0x042A;
+    static const wchar_t RUSSIAN_HARD_SIGN_LOWER = 0x044A;
+
+    static const wchar_t RUSSIAN_YERU_UPPER = 0x042B;
+    static const wchar_t RUSSIAN_YERU_LOWER = 0x044B;
+
+    static const wchar_t RUSSIAN_SOFT_SIGN_UPPER = 0x042C;
+    static const wchar_t RUSSIAN_SOFT_SIGN_LOWER = 0x044C;
+
+    static const wchar_t RUSSIAN_E_UPPER = 0x042D;
+    static const wchar_t RUSSIAN_E_LOWER = 0x044D;
+
+    static const wchar_t RUSSIAN_YU_UPPER = 0x042E;
+    static const wchar_t RUSSIAN_YU_LOWER = 0x044E;
+
+    static const wchar_t RUSSIAN_YA_UPPER = 0x042F;
+    static const wchar_t RUSSIAN_YA_LOWER = 0x044F;
+
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class russian_stem
+        Russian stemming class.
+
+    PERFECTIVE GERUND:
+        - Group 1: в вши вшись
+        - Group 2: ив ивши ившись ыв ывши ывшись
+
+    Group 1 endings must follow 'а' or 'я'.
+    
+    REFLEXIVE:
+        - ся сь
+
+    NOUN:
+        - а ев ов ие ье е иями ями ами еи ии и ией ей ой ий й иям ям ием ем ам ом о у ах иях ях ы ь ию ью ю ия ья я
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for a PERFECTIVE GERUND ending. If one is found remove it,
+    and that is then the end of step 1. Otherwise try and remove a REFLEXIVE ending,
+    and then search in turn for:
+        -# an ADJECTIVAL,
+        -# a VERB or
+        -# a NOUN ending.
+    As soon as one of the endings (1) to (3) is found remove it, and terminate step 1.
+
+    <b>Step 2:</b>
+
+    If the word ends with 'и', then remove it.
+
+    <b>Step 3:</b>
+
+    Search for a DERIVATIONAL (ост, ость) ending in R2 (i.e., the entire ending must lie in R2), and if one is found, then remove it.
+
+    <b>Step 4:</b>
+
+    -# Undouble 'н', or
+    -# if the word ends with a SUPERLATIVE (ейш or ейше) ending, remove it and undouble 'н', or
+    -# if the word ends 'ь', then remove it.
+    */
+    template <typename string_typeT = std::wstring>
+    class russian_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 2)
+                { return; }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::find_r1(text, RUSSIAN_VOWELS);
+            stem<string_typeT>::find_r2(text, RUSSIAN_VOWELS);
+            stem<string_typeT>::find_russian_rv(text, RUSSIAN_VOWELS);
+
+            //change 33rd letter ('&#x0451;') to '&#x0435;'
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0x0451)
+                    { text[i] = RUSSIAN_IE_LOWER; }
+                else if (text[i] == 0x0401)
+                    { text[i] = RUSSIAN_IE_UPPER; }
+                }
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+            step_4(text);
+            }
+    private:
+        void step_1(string_typeT& text)
+            {
+            //search for a perfect gerund
+            //group 2
+            if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER,
+                                   RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                   RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                   RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                   RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                   RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                   RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                   RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                   RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                   RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                   RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) )
+                { return; }
+            //group 1
+            else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                        RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                        RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                        RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                        RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) )
+                {
+                if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER,
+                                    RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                    RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                    RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                    RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                    RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) ||
+                    stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER,
+                                    RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                    RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                    RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                    RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                    RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) )
+                    {
+                    text.erase(text.end()-5, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            //group 2
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                        RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                        RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                        RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                     stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER,
+                                        RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                        RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                        RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) )
+                { return; }
+            //group 1
+            else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                        RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                        RUSSIAN_I_LOWER, RUSSIAN_I_UPPER) )
+                {
+                if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER,
+                                    RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                    RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                    RUSSIAN_I_LOWER, RUSSIAN_I_UPPER) ||
+                    stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER,
+                                    RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                    RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                    RUSSIAN_I_LOWER, RUSSIAN_I_UPPER) )
+                    {
+                    text.erase(text.end()-3, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            //group 2
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) )
+                { return; }
+            //group 1
+            else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER) )
+                {
+                if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER) ||
+                    stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER) )
+                    {
+                    text.erase(text.end()-1, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            //reflexive
+            if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) )
+                { /*NOOP*/ }
+            //adjectival
+            if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_UPPER, RUSSIAN_YERU_LOWER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_GHE_LOWER, RUSSIAN_GHE_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_GHE_LOWER, RUSSIAN_GHE_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_HA_LOWER, RUSSIAN_HA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_HA_LOWER, RUSSIAN_HA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) )
+                {
+                //delete participles
+                //group 2
+                if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER, false) ||
+                    stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER, false) ||
+                    stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, RUSSIAN_SHCHA_LOWER, RUSSIAN_SHCHA_UPPER, false) )
+                    {/*NOOP*/}
+                //group 1
+                else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER) ||
+                        stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER) ||
+                        stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER) ||
+                        stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, RUSSIAN_SHCHA_LOWER, RUSSIAN_SHCHA_UPPER) )
+                    {
+                    if (text.length() >= 3 &&
+                        stem<string_typeT>::get_rv() <= text.length()-3 &&
+                        (is_either<wchar_t>(text[text.length()-3], RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                        is_either<wchar_t>(text[text.length()-3], RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER)) )
+                        {
+                        text.erase(text.end()-2, text.end() );
+                        stem<string_typeT>::update_r_sections(text);
+                        return;
+                        }
+                    }
+                else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_SHCHA_LOWER, RUSSIAN_SHCHA_UPPER) )
+                    {
+                    if (text.length() >= 2 &&
+                        stem<string_typeT>::get_rv() <= text.length()-2 &&
+                        (is_either<wchar_t>(text[text.length()-2], RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                        is_either<wchar_t>(text[text.length()-2], RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER)) )
+                        {
+                        text.erase(text.end()-1, text.end() );
+                        stem<string_typeT>::update_r_sections(text);
+                        return;
+                        }
+                    }
+                return;
+                }
+            //verb
+            //group 2
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||/*4*/
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) )
+                {
+                return;
+                }
+            //group 1
+            if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER) )
+                {
+                if (text.length() >= 4 &&
+                    stem<string_typeT>::get_rv() <= text.length()-4 &&
+                    (is_either<wchar_t>(text[text.length()-4], RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                    is_either<wchar_t>(text[text.length()-4], RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER)) )
+                    {
+                    text.erase(text.end()-3, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            //group 2
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) )
+                {
+                return;
+                }
+            //group 1
+            else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||/*2*/
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= text.length()-3 &&
+                    (is_either<wchar_t>(text[text.length()-3], RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                    is_either<wchar_t>(text[text.length()-3], RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER)) )
+                    {
+                    text.erase(text.end()-2, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER) ||/*1*/
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER) )
+                {
+                if (text.length() >= 2 &&
+                    stem<string_typeT>::get_rv() <= text.length()-2 &&
+                    (is_either<wchar_t>(text[text.length()-2], RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                    is_either<wchar_t>(text[text.length()-2], RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER)) )
+                    {
+                    text.erase(text.end()-1, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+
+            //noun
+            if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                   RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER,
+                                   RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER,
+                                   RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_HA_LOWER, RUSSIAN_HA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, RUSSIAN_HA_LOWER, RUSSIAN_HA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_HA_LOWER, RUSSIAN_HA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) )
+                { return; }
+            }
+        void step_2(string_typeT& text)
+            { stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_UPPER, RUSSIAN_I_LOWER); }
+        void step_3(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER,
+                                   RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                   RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER,
+                                   RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER,
+                                   RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                   RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER,
+                                   RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER,
+                                RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER,
+                                   RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                   RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER);
+                }
+            }
+        void step_4(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER,
+                                RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER) )
+                {
+                text.erase(text.end()-1, text.end() );
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER,
+                                          RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER,
+                                          RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                          RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER,
+                                          RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER,
+                                          RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER))
+                {
+                if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER,
+                                RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER) )
+                    {
+                    text.erase(text.end()-1, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else
+                { stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER); }
+            }
+        };
+    }
+
+#endif //__RUSSIAN_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/spanish_stem.h b/third-party/OleanderStemmingLibrary/stemming/spanish_stem.h
new file mode 100644 (file)
index 0000000..952f7b6
--- /dev/null
@@ -0,0 +1,1396 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __SPANISH_STEM_H__
+#define __SPANISH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class spanish_stem
+        Spanish stemming class.
+
+    Letters in Spanish include the following accented forms:
+        - á é í ó ú ü ñ
+    
+    The following letters are vowels:
+        - a e i o u á é í ó ú ü
+    
+    R2 is defined in the usual way - see the note on R1 and R2.
+
+    RV is defined as follows (and this is not the same as the French stemmer definition):
+
+    If the second letter is a consonant, RV is the region after the next following vowel,
+    or if the first two letters are vowels, RV is the region after the next consonant,
+    and otherwise (consonant-vowel case) RV is the region after the third letter.
+    But RV is the end of the word if these positions cannot be found.
+
+    For example,
+
+        m a c h o     o l i v a     t r a b a j o     á u r e o
+             |...|         |...|         |.......|         |...|
+
+    \par Algorithm:
+
+    Always do steps 0 and 1.
+
+    <b>Step 0:</b>
+
+    Search for the longest among the following suffixes
+        - me se sela selo selas selos la le lo las les los nos
+            - Delete it, if comes after one of 
+                - iéndo ándo ár ér ír
+                - ando iendo ar er ir
+                - yendo, following u
+
+    in RV. In the case of (c), yendo must lie in RV, but the preceding u can be outside it.
+
+    In the case of (a), deletion is followed by removing the acute accent
+    (for example, haciéndola -> haciendo).
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated.
+        - anza anzas ico ica icos icas ismo ismos able ables ible ibles ista istas oso osa osos osas amiento amientos imiento imientos
+            - Delete if in R2.
+        - adora ador ación adoras adores aciones ante antes ancia ancias
+            - Delete if in R2.
+            - If preceded by ic, delete if in R2
+        - logía logías
+            - Replace with log if in R2.
+        - ución uciones
+            - Replace with u if in R2.
+        - encia encias
+            - Replace with ente if in R2.
+        - amente
+            - Delete if in R1.
+            - If preceded by iv, delete if in R2 (and if further preceded by at, delete if in R2), otherwise,
+            - If preceded by os, ic or ad, delete if in R2.
+        - mente
+            - Delete if in R2.
+            - If preceded by ante, able or ible, delete if in R2.
+        - idad idades
+            - Delete if in R2
+            - If preceded by abil, ic or iv, delete if in R2.
+        - iva ivo ivas ivos
+            - Delete if in R2.
+            - If preceded by at, delete if in R2.
+
+    Do step 2(a) if no ending was removed by step 1.
+
+    <b>Step 2(a):</b>
+
+    Search for the longest among the following suffixes in RV, and if found, delete if preceded by u.
+        - ya ye yan yen yeron yendo yo yó yas yes yais yamos
+
+    (Note that the preceding u need not be in RV).
+
+    <b>Step 2(b):</b>
+
+    Do Step 2(b) if step 2(a) was done, but failed to remove a suffix.
+
+    Search for the longest among the following suffixes in RV, and perform the action indicated.
+            - en es éis emos
+                - Delete, and if preceded by gu delete the u (the gu need not be in RV).
+            - arían arías arán arás aríais aría aréis aríamos aremos ará aré erían erías
+            erán erás eríais ería eréis eríamos eremos erá eré irían irías irán irás iríais
+            iría iréis iríamos iremos irá iré aba ada ida ía ara iera ad ed id ase iese aste
+            iste an aban ían aran ieran asen iesen aron ieron ado ido ando iendo ió ar er ir
+            as abas adas idas ías aras ieras ases ieses ís áis abais íais arais ierais
+            aseis ieseis asteis isteis ados idos amos ábamos íamos imos áramos iéramos iésemos ásemos
+                - Delete.
+
+    Always do step 3.
+
+    <b>Step 3:</b>
+
+    Search for the longest among the following suffixes in RV, and perform the action indicated.
+            - os a o á í ó
+                - Delete if in RV.
+            - e é
+                - Delete if in RV, and if preceded by gu with the u in RV delete the u.
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class spanish_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                stem<string_typeT>::remove_spanish_acutes(text);
+                return;
+                }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            stem<string_typeT>::find_r1(text, SPANISH_VOWELS);
+            stem<string_typeT>::find_r2(text, SPANISH_VOWELS);
+            stem<string_typeT>::find_spanish_rv(text, SPANISH_VOWELS);
+
+            step_0(text);
+            step_1(text);
+            ///steps 2a and 2b and only called from step1
+            step_3(text);
+
+            stem<string_typeT>::remove_spanish_acutes(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_0(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_rv(text,/*selos*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 5))
+                    { return; }
+                if (step_0b(text, 5))
+                    { return; }
+                if (step_0c(text, 5))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*selas*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 5))
+                    { return; }
+                if (step_0b(text, 5))
+                    { return; }
+                if (step_0c(text, 5))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*sela*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A))
+                {
+                if (step_0a(text, 4))
+                    { return; }
+                if (step_0b(text, 4))
+                    { return; }
+                if (step_0c(text, 4))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*selo*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O))
+                {
+                if (step_0a(text, 4))
+                    { return; }
+                if (step_0b(text, 4))
+                    { return; }
+                if (step_0c(text, 4))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*las*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 3))
+                    { return; }
+                if (step_0b(text, 3))
+                    { return; }
+                if (step_0c(text, 3))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*les*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 3))
+                    { return; }
+                if (step_0b(text, 3))
+                    { return; }
+                if (step_0c(text, 3))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*los*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 3))
+                    { return; }
+                if (step_0b(text, 3))
+                    { return; }
+                if (step_0c(text, 3))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*nos*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 3))
+                    { return; }
+                if (step_0b(text, 3))
+                    { return; }
+                if (step_0c(text, 3))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*la*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A))
+                {
+                if (step_0a(text, 2))
+                    { return; }
+                if (step_0b(text, 2))
+                    { return; }
+                if (step_0c(text, 2))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*le*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E))
+                {
+                if (step_0a(text, 2))
+                    { return; }
+                if (step_0b(text, 2))
+                    { return; }
+                if (step_0c(text, 2))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*lo*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O))
+                {
+                if (step_0a(text, 2))
+                    { return; }
+                if (step_0b(text, 2))
+                    { return; }
+                if (step_0c(text, 2))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*me*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E))
+                {
+                if (step_0a(text, 2))
+                    { return; }
+                if (step_0b(text, 2))
+                    { return; }
+                if (step_0c(text, 2))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*se*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E))
+                {
+                if (step_0a(text, 2))
+                    { return; }
+                if (step_0b(text, 2))
+                    { return; }
+                if (step_0c(text, 2))
+                    { return; }
+                return;
+                }
+            }
+        //---------------------------------------------
+        bool step_0a(string_typeT& text, size_t suffix_length)
+            {
+            if ((text.length() >= suffix_length+5) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(5+suffix_length)) &&
+                /*iéndo*/
+                (is_either<wchar_t>(text[text.length()-(5+suffix_length)], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE) &&
+                    is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                text[text.length()-4] = common_lang_constants::LOWER_E;
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+4) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(4+suffix_length)) &&
+                /*ándo*/
+                (is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE) &&
+                    is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                text[text.length()-4] = common_lang_constants::LOWER_A;
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*ár*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                text[text.length()-2] = common_lang_constants::LOWER_A;
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*ér*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                text[text.length()-2] = common_lang_constants::LOWER_E;
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length + 2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*ír*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                text[text.length()-2] = common_lang_constants::LOWER_I;
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            return false;
+            }
+
+        //---------------------------------------------
+        bool step_0b(string_typeT& text, size_t suffix_length)
+            {
+            if ((text.length() >= suffix_length+5) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(5+suffix_length)) &&
+                /*iendo*/
+                (is_either<wchar_t>(text[text.length()-(5+suffix_length)], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+4) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(4+suffix_length)) &&
+                /*ando*/
+                (is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*ar*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*er*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*ir*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            return false;
+            }
+
+        //---------------------------------------------
+        bool step_0c(string_typeT& text, size_t suffix_length)
+            {
+            if ((text.length() >= suffix_length+6) &&
+                stem<string_typeT>::get_rv() <= text.length()-(suffix_length+5) &&
+                /*uyendo*/
+                (is_either<wchar_t>(text[text.length()-(6+suffix_length)], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) &&
+                    is_either<wchar_t>(text[text.length()-(5+suffix_length)], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                    is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            return false;
+            }
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            size_t original_length = text.length();
+            if (stem<string_typeT>::delete_if_is_in_r2(text,/*imientos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*amientos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*uciones*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-6);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*amiento*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*imiento*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*aciones*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*logías*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-3);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*encias*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-2);
+                text[text.length()-2] = common_lang_constants::LOWER_T;
+                text[text.length()-1] = common_lang_constants::LOWER_E;
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*idades*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                        {
+                        return;
+                        }
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*amente*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (original_length > text.length() )
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                        {
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                        return;
+                        }
+                    else
+                        {
+                        if (stem<string_typeT>::delete_if_is_in_r2(text,/*os*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                            stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                            stem<string_typeT>::delete_if_is_in_r2(text,/*ad*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                            {
+                            return;
+                            }
+                        }
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*adores*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                     stem<string_typeT>::delete_if_is_in_r2(text,/*adoras*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                     stem<string_typeT>::delete_if_is_in_r2(text,/*ancias*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*adora*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                     stem<string_typeT>::delete_if_is_in_r2(text,/*ación*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                     stem<string_typeT>::delete_if_is_in_r2(text,/*antes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                     stem<string_typeT>::delete_if_is_in_r2(text,/*ancia*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ibles*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*istas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ables*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ismos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*anzas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*logía*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*ución*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                text.erase(text.length()-4);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*encia*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                text.erase(text.length()-1);
+                text[text.length()-2] = common_lang_constants::LOWER_T;
+                text[text.length()-1] = common_lang_constants::LOWER_E;
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*mente*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (original_length > text.length() )
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r2(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*able*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ible*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                        {
+                        return;
+                        }
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*anza*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*icos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*icas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ismo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*able*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ible*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ista*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osos*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osas*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ador*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*idad*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                if (original_length > text.length() )
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                        {
+                        return;
+                        }
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ico*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ica*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*oso*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osa*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*iva*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    return;
+                    }
+                step_2a(text);
+                }    
+            //this should only be called from here if nothing was removed in step 1
+            if (text.length() == original_length)
+                {
+                step_2a(text);
+                }
+            }
+        //---------------------------------------------
+        void step_2a(string_typeT& text)
+            {
+            size_t original_length = text.length();
+            if (stem<string_typeT>::is_suffix_in_rv(text,/*yeron*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N))
+                {
+                if (is_either<wchar_t>(text[text.length()-6], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yendo*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O))
+                {
+                if (text.length() >= 6 &&
+                    is_either<wchar_t>(text[text.length()-6], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yamos*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (text.length() >= 6 &&
+                    is_either<wchar_t>(text[text.length()-6], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yais*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (text.length() >= 5 &&
+                    is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yan*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N))
+                {
+                if (text.length() >= 4 &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yen*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N))
+                {
+                if (text.length() >= 4 &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yas*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (text.length() >= 4 &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yes*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (text.length() >= 4 &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ya*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A))
+                {
+                if (text.length() >= 3 &&
+                    is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ye*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E))
+                {
+                if (text.length() >= 3 &&
+                    is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yo*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O))
+                {
+                if (text.length() >= 3 &&
+                    is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yó*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE))
+                {
+                if (text.length() >= 3 &&
+                    is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            //only called if 2a fails to remove a suffix
+            if (text.length() == original_length)
+                {
+                step_2b(text);
+                }
+            }
+        //---------------------------------------------
+        void step_2b(string_typeT& text) 
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*aríamos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eríamos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iríamos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iéramos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iésemos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aríais*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aremos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eríais*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eremos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iríais*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iremos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ierais*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ieseis*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asteis*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isteis*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ábamos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*áramos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ásemos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arían*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arías*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aréis*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erían*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erías*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eréis*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irían*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irías*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iréis*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ieran*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iesen*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ieron*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iendo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ieras*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ieses*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*abais*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arais*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aseis*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íamos*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*emos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arán*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arás*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aría*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erán*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erás*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ería*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irán*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irás*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iría*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iera*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iese*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aste*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iste*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aban*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aran*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asen*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aron*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ando*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*abas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*adas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*idas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aras*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ases*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íais*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ados*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*idos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*amos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*imos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ará*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aré*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erá*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eré*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irá*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iré*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aba*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ada*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ida*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ara*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ase*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ían*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ado*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ido*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ías*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*áis*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*éis*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ía*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ad*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ed*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*id*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*an*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ió*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ar*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ir*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*as*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ís*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+         //---------------------------------------------
+        void step_3(string_typeT& text) 
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*os*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*a*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*o*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*á*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*í*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ó*/common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE) )
+                {
+                return;
+                }
+
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*é*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE) ||
+                    stem<string_typeT>::delete_if_is_in_rv(text,/*e*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::is_suffix_in_rv(text,/*u*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U))
+                    {
+                    if (text.length() >= 2 &&
+                        is_either<wchar_t>(text[text.length()-2], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                        {
+                        text.erase(text.length()-1);
+                        }
+                    }
+                return;
+                }
+            }
+        };
+    }
+
+#endif //__SPANISH_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/stemming.h b/third-party/OleanderStemmingLibrary/stemming/stemming.h
new file mode 100644 (file)
index 0000000..4483846
--- /dev/null
@@ -0,0 +1,2337 @@
+/**
+\date 2003-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __STEM_H__
+#define __STEM_H__
+
+#include <algorithm>
+#include "../indexing/string_util.h"
+#include "../indexing/common_lang_constants.h"
+
+namespace stemming
+    {
+    enum stemming_type
+        {
+        no_stemming,
+        danish,
+        dutch,
+        english,
+        finnish,
+        french,
+        german,
+        italian,
+        norwegian,
+        portuguese,
+        spanish,
+        swedish,
+        STEMMING_TYPE_COUNT
+        };
+    //these characters should not appear in an indexed word
+    const wchar_t UPPER_Y_HASH = 7;//bell
+    const wchar_t LOWER_Y_HASH = 9;//tab
+    const wchar_t UPPER_I_HASH = 10;//line feed
+    const wchar_t LOWER_I_HASH = 11;//vertical tab
+    const wchar_t UPPER_U_HASH = 12;//form feed (new page)
+    const wchar_t LOWER_U_HASH = 13;//carriage return
+
+    //language constants
+    static const wchar_t FRENCH_VOWELS[] = { 97, 101, 105, 111, 117, 121, 0xE2,
+        0xE0, 0xEB, 0xE9,
+        0xEA, 0xE8, 0xEF,
+        0xEE, 0xF4, 0xFB,
+        0xF9, 65, 69, 73, 79, 85, 89, 0xC2,
+        0xC0, 0xCB, 0xC9,
+        0xCA, 0xC8, 0xCF,
+        0xCE, 0xD4, 0xDB,
+        0xD9, 0 };
+    static const wchar_t FRENCH_ACCENTED_E[] = { 0xE9, 0xE8,
+        0xC9, 0xC8, 0 };
+    static const wchar_t FRENCH_AIOUES[] = { 97, 105, 111, 117, 0xE8, 115, 65, 73, 79, 85,
+        0xC8, 83, 0 };
+
+    static const wchar_t GERMAN_VOWELS[] = { 97, 101, 105, 111, 117, 0xFC, 121,
+        0xE4, 0xF6, 65, 0xC4,
+        69, 73, 79, 0xD6, 85, 0xDC, 89, 0 };
+
+    static const wchar_t DANISH_VOWELS[] = { 97, 101, 105, 111, 117, 121, 0xE6,
+        0xE5, 0xF8, 65, 69, 73, 79, 85, 89,
+        0xC6, 0xC5, 0xD8, 0 };
+    static const wchar_t DANISH_ALPHABET[] = { 97, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 111, 112, 114,
+        116, 118, 121, 122, 0xE5, 65, 66, 67, 68, 70, 71, 72, 74, 75, 76, 77, 78, 79,
+        80, 82, 84, 86, 89, 90, 0xC5, 0 };
+
+    static const wchar_t FINNISH_VOWELS[] = { 97, 101, 105, 111, 117, 121, 0xE4, 0xF6, 65, 69, 73, 79, 85, 89,
+        0xC4, 0xD6, 0 };
+    static const wchar_t FINNISH_VOWELS_NO_Y[] = { 97, 101, 105, 111, 117, 0xE4, 0xF6, 65, 69, 73, 79, 85,
+        0xC4, 0xD6, 0 };
+    static const wchar_t FINNISH_VOWELS_SIMPLE[] = { 97, 101, 105, 0xE4, 65, 69, 73, 0xC4, 0 };
+    static const wchar_t FINNISH_STEP_1_SUFFIX[] = { 110, 116, 97, 101, 105, 111, 117, 121, 0xE4,
+        0xF6, 78, 84, 65, 69, 73, 79, 85, 89, 0xC4, 0xD6, 0 };
+
+    static const wchar_t DUTCH_VOWELS[] = { 97, 101, 105, 111, 117, 121, 0xE8,
+        65, 69, 73, 79, 85, 89, 0xC8, 0 };
+    static const wchar_t DUTCH_KDT[] = { 107, 100, 116, 75, 68, 84, 0 };
+    static const wchar_t DUTCH_S_ENDING[] = { 97, 101, 0xE8, 105, 111, 117, 121, 106, 65, 69,
+        0xC8, 73, 79, 85, 89, 74, 0 };
+
+    static const wchar_t NORWEGIAN_VOWELS[] = { 97, 101, 105, 111, 0xF8, 117, 121, 0xE5,
+        0xE6, 0xC5, 65, 0xC6, 69, 73, 79,
+        0xD8, 85, 89, 0 };
+    static const wchar_t PORTUGUESE_VOWELS[] = { 97, 101, 105, 111, 117, 0xE1, 0xE9,
+        0xED, 0xF3, 0xFA, 0xE2,
+        0xEA, 0xF4, 65, 69, 73, 79, 85, 0xC1,
+        0xC9, 0xCD, 0xD3, 0xDA,
+        0xC2, 0xCA, 0xD4, 0 };
+    static const wchar_t SPANISH_VOWELS[] = { 97, 101, 105, 111, 117, 0xE1, 0xE9,
+        0xED, 0xF3, 0xFA, 0xFC,
+        65, 69, 73, 79, 85, 0xC1, 0xC9, 0xCD,
+        0xD3, 0xDA, 0xDC, 0 };
+
+    static const wchar_t SWEDISH_VOWELS[] = { 97, 101, 105, 111, 117, 121, 0xE5,
+        0xE4, 0xF6, 65, 69, 73, 79, 85, 89,
+        0xC5, 0xC4, 0xD6, 0 };
+
+    static const wchar_t ITALIAN_VOWELS[] = { 97, 101, 105, 111, 117, 0xE0,
+        0xE8, 0xEC, 0xF2,
+        0xF9, 65, 69, 73, 79, 85, 0xC0,
+        0xC8, 0xCC, 0xD2,
+        0xD9, 0 };
+    static const wchar_t ITALIAN_VOWELS_SIMPLE[] = { 97, 101, 105, 111, 0xE0,
+        0xE8, 0xEC, 0xF2,
+        65, 69, 73, 79, 0xC0, 0xC8,
+        0xCC, 0xD2, 0 };
+
+    /**\addtogroup Stemming
+        Language-specific stemming classes.
+    * @{*/
+    /**
+       @class stem
+       @brief The base class for language-specific stemmers. The template argument for the stemmers are the type
+       of std::basic_string that you are trying to stem, by default std::wstring (Unicode strings).
+       As long as the char type of your basic_string is wchar_t, then you can use any type of basic_string.
+       This is to say, if your basic_string has a custom char_traits or allocator, then just specify it in
+       your template argument to the stemmer. Example:
+       \code
+        typedef std::basic_string<wchar_t, myTraits, myAllocator> myString;
+        myString word(L"documentation");
+        stemming::english_stem<myString> StemEnglish;
+        StemEnglish(word);
+       \endcode */
+    template <typename string_typeT = std::wstring>
+    class stem
+        {
+    public:
+        stem() : m_r1(0), m_r2(0), m_rv(0) {}
+    protected:
+        //R1, R2, RV functions
+        void find_r1(const string_typeT& text,
+                    const wchar_t* vowel_list)
+            {
+            //see where the R1 section begin
+            //R1 is the region after the first consonant after the first vowel
+            size_t start = text.find_first_of(vowel_list, 0);
+            if (start == string_typeT::npos)
+                {
+                //we need at least need a vowel somewhere in the word
+                m_r1 = text.length();
+                return;
+                }
+
+            m_r1 = text.find_first_not_of(vowel_list,++start);
+            if (get_r1() == string_typeT::npos)
+                {
+                m_r1 = text.length();
+                }
+            else
+                {
+                ++m_r1;
+                }
+            }
+
+        void find_r2(const string_typeT& text,
+                    const wchar_t* vowel_list)
+            {
+            size_t start = 0;
+            //look for R2--not required for all criteria.
+            //R2 is the region after the first consonant after the first vowel after R1
+            if (get_r1() != text.length() )
+                {
+                start = text.find_first_of(vowel_list, get_r1());
+                }
+            else
+                {
+                start = string_typeT::npos;
+                }
+            if (start != string_typeT::npos &&
+                static_cast<int>(start) != static_cast<int>(text.length())-1)
+                {
+                m_r2 = text.find_first_not_of(vowel_list,++start);
+                if (get_r2() == string_typeT::npos)
+                    {
+                    m_r2 = text.length();
+                    }
+                else
+                    {
+                    ++m_r2;
+                    }
+                }
+            else
+                {
+                m_r2 = text.length();
+                }
+            }
+
+        void find_spanish_rv(const string_typeT& text,
+                    const wchar_t* vowel_list)
+            {
+            //see where the RV section begin
+            if (text.length() < 4)
+                {
+                m_rv = text.length();
+                return;
+                }
+            //if second letter is a consonant
+            if (!string_util::is_one_of(text[1], vowel_list) )
+                {
+                size_t start = text.find_first_of(vowel_list, 2);
+                if (start == string_typeT::npos)
+                    {
+                    //can't find next vowel
+                    m_rv = text.length();
+                    return;
+                    }
+                else
+                    {
+                    m_rv = start+1;
+                    }
+                }
+            //if first two letters are vowels
+            else if (string_util::is_one_of(text[0], vowel_list) &&
+                    string_util::is_one_of(text[1], vowel_list))
+                {
+                size_t start = text.find_first_not_of(vowel_list, 2);
+                if (start == string_typeT::npos)
+                    {
+                    //can't find next consonant
+                    m_rv = text.length();
+                    return;
+                    }
+                else
+                    {
+                    m_rv = start+1;
+                    }
+                }
+            //consonant/vowel at beginning
+            else if (!string_util::is_one_of(text[0], vowel_list) &&
+                    string_util::is_one_of(text[1], vowel_list))
+                {
+                m_rv = 3;
+                }
+            else
+                {
+                m_rv = text.length();
+                }
+            }
+
+        /*If the word begins with two vowels, RV is the region after the third letter,
+        otherwise the region after the first vowel not at the beginning of the word,
+        or the end of the word if these positions cannot be found.
+        (Exceptionally, par, col or tap, at the begining of a word is also taken to be the region before RV.)*/
+        void find_french_rv(const string_typeT& text,
+                    const wchar_t* vowel_list)
+            {
+            //see where the RV section begin
+            if (text.length() < 3)
+                {
+                m_rv = text.length();
+                return;
+                }
+            /*Exceptions: If the word begins with these then RV goes right after them,
+            whether it be a letter or simply the end of the word.*/
+            if (text.length() >= 3 &&
+                ((is_either<wchar_t>(text[0], common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) &&
+                is_either<wchar_t>(text[1], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                is_either<wchar_t>(text[2], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) || //par
+
+                (is_either<wchar_t>(text[0], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                is_either<wchar_t>(text[1], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                is_either<wchar_t>(text[2], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ) || //col
+
+                (is_either<wchar_t>(text[0], common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) &&
+                is_either<wchar_t>(text[1], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                is_either<wchar_t>(text[2], common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) ))//tap
+                )
+                {
+                m_rv = 3;
+                return;
+                }
+            //if first two letters are vowels
+            if (string_util::is_one_of(text[0], vowel_list) &&
+                string_util::is_one_of(text[1], vowel_list))
+                {
+                m_rv = 3;
+                }
+            else
+                {
+                size_t start = text.find_first_not_of(vowel_list, 0);
+                if (start == string_typeT::npos)
+                    {
+                    //can't find first consonant
+                    m_rv = text.length();
+                    return;
+                    }
+                start = text.find_first_of(vowel_list, start);
+                if (start == string_typeT::npos)
+                    {
+                    //can't find first vowel
+                    m_rv = text.length();
+                    return;
+                    }
+                m_rv = start+1;
+                }
+            }
+
+        void find_russian_rv(const string_typeT& text,
+                    const wchar_t* vowel_list)
+            {
+            size_t start = text.find_first_of(vowel_list);
+            if (start == string_typeT::npos)
+                {
+                //can't find first vowel
+                m_rv = text.length();
+                return;
+                }
+            else
+                {
+                m_rv = start+1;
+                }
+            }
+
+        inline void update_r_sections(const string_typeT& text)
+            {
+            if (get_r1() > text.length() )
+                {
+                m_r1 = text.length();
+                }
+            if (get_r2() > text.length() )
+                {
+                m_r2 = text.length();
+                }
+            if (get_rv() > text.length() )
+                {
+                m_rv = text.length();
+                }
+            }
+        /**Determines if a character is an apostrophe (includes straight single quotes).
+        @param ch The letter to be analyzed.*/
+        inline bool is_apostrophe(const wchar_t& ch) const
+            {
+            return (ch == 39) ? //'
+                true : (ch == 146) ? //apostrophe
+                true : (ch == 180) ? //apostrophe
+                true : (ch == 0x2019) ? //right single apostrophe
+                true : false;
+            }
+        //---------------------------------------------
+        void trim_western_punctuation(string_typeT& text) const
+            {
+            if (text.length() >= 3 &&
+                is_apostrophe(text[text.length()-3]) &&
+                is_either<wchar_t>(text[text.length()-2], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                is_apostrophe(text[text.length()-1]) )
+                { text.erase(text.length()-3); }
+            else if (text.length() >= 2 &&
+                is_apostrophe(text[text.length()-2]) &&
+                is_either<wchar_t>(text[text.length()-1], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                { text.erase(text.length()-2); }
+            else if (is_apostrophe(text[text.length()-1]))
+                { text.erase(text.length()-1); }
+            while (text.length() )
+                {
+                const wchar_t lastChar = text[text.length()-1];
+                if (!(lastChar >= 48 && lastChar <= 57) &&
+                    !(lastChar >= 65 && lastChar <= 90) &&
+                    !(lastChar >= 97 && lastChar <= 122) &&
+                    !(lastChar >= 192 && lastChar <= 246) &&
+                    !(lastChar >= 248 && lastChar <= 255) &&
+                    lastChar != 0xA0)//space
+                    {
+                    text.erase(text.length()-1);
+                    }
+                else
+                    { break; }
+                }
+            while (text.length() )
+                {
+                if (!(text[0] >= 48 && text[0] <= 57) &&
+                    !(text[0] >= 65 && text[0] <= 90) &&
+                    !(text[0] >= 97 && text[0] <= 122) &&
+                    !(text[0] >= 192 && text[0] <= 246) &&
+                    !(text[0] >= 248 && text[0] <= 255) )
+                    { text.erase(0, 1); }
+                else
+                    { break; }
+                }
+            }
+
+        //suffix removal determinant functions
+        ///is_suffix for one character
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U) const
+            {
+            if (text.length() < 1)
+                { return false; }
+            return is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U);
+            }
+        ///is_suffix for two characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U) const
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U);
+            }
+
+        ///is_suffix for three characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U) const
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U);
+            }
+        ///is_suffix for four characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U) const
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U);
+            }
+        ///is_suffix for five characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U) const
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U);
+            }
+        ///is_suffix for six characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U) const
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U);
+            }
+        ///is_suffix for seven characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U) const
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U);
+            }
+        ///is_suffix for eight characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const wchar_t suffix8L, const wchar_t suffix8U) const
+            {
+            if (text.length() < 8)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-8], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-7], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix7L, suffix7U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix8L, suffix8U);
+            }
+        ///is_suffix for nine characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const wchar_t suffix8L, const wchar_t suffix8U,
+                    const wchar_t suffix9L, const wchar_t suffix9U) const
+            {
+            if (text.length() < 9)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-9], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-8], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-7], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix7L, suffix7U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix8L, suffix8U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix9L, suffix9U);
+            }
+
+        ///comparison for two characters
+        inline bool is_partial_suffix(const string_typeT& text,
+                    const size_t start_index,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U)
+            {
+            if ((start_index+2) >= text.length())
+                { return false; }
+            return (is_either<wchar_t>(text[start_index], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[start_index+1], suffix2L, suffix2U));
+            }
+        ///comparison for three characters
+        inline bool is_partial_suffix(const string_typeT& text,
+                    const size_t start_index,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U)
+            {
+            if ((start_index+3) >= text.length())
+                { return false; }
+            return (is_either<wchar_t>(text[start_index], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[start_index+1], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[start_index+2], suffix3L, suffix3U));
+            }
+
+        ///RV suffix functions
+        //-------------------------------------------------
+        ///RV suffix comparison for one character
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U)
+            {
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            return (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U) &&
+                    (get_rv() <= text.length()-1) );
+            }
+        ///RV suffix comparison for two characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U) ) &&
+                    (get_rv() <= text.length()-2) );
+            }
+        ///RV suffix comparison for three characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) ) &&
+                    (get_rv() <= text.length()-3) );
+            }
+        ///RV suffix comparison for four characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) ) &&
+                    (get_rv() <= text.length()-4) );
+            }
+        ///RV suffix comparison for five characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) ) &&
+                    (get_rv() <= text.length()-5) );
+            }
+        ///RV suffix comparison for six characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) ) &&
+                    (get_rv() <= text.length()-6) );
+            }
+        ///RV suffix comparison for seven characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U)
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U) ) &&
+                    (get_rv() <= text.length()-7) );
+            }
+        ///RV suffix comparison for eight characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const wchar_t suffix8L, const wchar_t suffix8U)
+            {
+            if (text.length() < 8)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-8], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-7], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix7L, suffix7U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix8L, suffix8U) ) &&
+                    (get_rv() <= text.length()-8) );
+            }
+
+        ///R1 suffix functions
+        //-------------------------------------------------
+        ///R1 suffix comparison for one character
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U)
+            {
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            return (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U) &&
+                    (get_r1() <= text.length()-1) );
+            }
+        ///R1 suffix comparison for two characters
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U) ) &&
+                    (get_r1() <= text.length()-2) );
+            }
+        ///R1 suffix comparison for three characters
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) ) &&
+                    (get_r1() <= text.length()-3) );
+            }
+        ///R1 suffix comparison for four characters
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) ) &&
+                    (get_r1() <= text.length()-4) );
+            }
+        ///R1 suffix comparison for five characters
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) ) &&
+                    (get_r1() <= text.length()-5) );
+            }
+        ///R1 suffix comparison for six characters
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) ) &&
+                    (get_r1() <= text.length()-6) );
+            }
+
+        ///R2 suffix functions
+        //-------------------------------------------------
+        ///R2 suffix comparison for one character
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U)
+            {
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            return (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U) &&
+                    (get_r2() <= text.length()-1) );
+            }
+        ///R2 suffix comparison for two characters
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U) ) &&
+                    (get_r2() <= text.length()-2) );
+            }
+        ///R2 suffix comparison for three characters
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) ) &&
+                    (get_r2() <= text.length()-3) );
+            }
+        ///R2 suffix comparison for four characters
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) ) &&
+                    (get_r2() <= text.length()-4) );
+            }
+        ///R2 suffix comparison for five characters
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) ) &&
+                    (get_r2() <= text.length()-5) );
+            }
+        ///R2 suffix comparison for six characters
+        inline bool is_suffix_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) ) &&
+                    (get_r2() <= text.length()-6) );
+            }
+        ///R2 suffix comparison for seven characters
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U)
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U) ) &&
+                    (get_r2() <= text.length()-7) );
+            }
+
+        //suffix removal functions
+        //R1 deletion for one character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const bool success_on_find = true)
+            {
+            assert(suffix1L == string_util::tolower_western(suffix1U) );
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U))
+                {
+                if (get_r1() <= text.length()-1)
+                    {
+                    text.erase(text.length()-1);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for two character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U))
+                {
+                if (get_r1() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for three character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) )
+                {
+                if (get_r1() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for four character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) )
+                {
+                if (get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for five character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) )
+                {
+                if (get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for six character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) )
+                {
+                if (get_r1() <= text.length()-6)
+                    {
+                    text.erase(text.length()-6);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for seven character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U) )
+                {
+                if (get_r1() <= text.length()-7)
+                    {
+                    text.erase(text.length()-7);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+
+        //R2 deletion functions
+        //R2 deletion for one character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U))
+                {
+                if (get_r2() <= text.length()-1)
+                    {
+                    text.erase(text.length()-1);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R2 deletion for two character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U))
+                {
+                if (get_r2() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R2 deletion for three character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) )
+                {
+                if (get_r2() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R2 deletion for four character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) )
+                {
+                if (get_r2() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        ///R2 deletion for five character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) )
+                {
+                if (get_r2() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        ///R2 deletion for six character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) )
+                {
+                if (get_r2() <= text.length()-6)
+                    {
+                    text.erase(text.length()-6);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        ///R2 deletion for seven character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U) )
+                {
+                if (get_r2() <= text.length()-7)
+                    {
+                    text.erase(text.length()-7);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        ///R2 deletion for eight character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const wchar_t suffix8L, const wchar_t suffix8U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 8)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-8], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-7], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-6], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix6L, suffix6U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix7L, suffix7U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix8L, suffix8U) )
+                {
+                if (get_r2() <= text.length()-8)
+                    {
+                    text.erase(text.length()-8);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        
+        //RV deletion functions
+        //RV deletion for one character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U))
+                {
+                if (get_rv() <= text.length()-1)
+                    {
+                    text.erase(text.length()-1);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for two character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U))
+                {
+                if (get_rv() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for three character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) )
+                {
+                if (get_rv() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for four character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) )
+                {
+                if (get_rv() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for five character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) )
+                {
+                if (get_rv() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for six character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) )
+                {
+                if (get_rv() <= text.length()-6)
+                    {
+                    text.erase(text.length()-6);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for seven character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U) )
+                {
+                if (get_rv() <= text.length()-7)
+                    {
+                    text.erase(text.length()-7);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for eight character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const wchar_t suffix8L, const wchar_t suffix8U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 8)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-8], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-7], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-6], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix6L, suffix6U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix7L, suffix7U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix8L, suffix8U) )
+                {
+                if (get_rv() <= text.length()-8)
+                    {
+                    text.erase(text.length()-8);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+
+        //string support functions
+        void remove_german_umlauts(string_typeT& text)
+            {
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0xC4)
+                    {
+                    text[i] = common_lang_constants::UPPER_A;
+                    }
+                else if (text[i] == 0xD6)
+                    {
+                    text[i] = common_lang_constants::UPPER_O;
+                    }
+                else if (text[i] == 0xDC)
+                    {
+                    text[i] = common_lang_constants::UPPER_U;
+                    }
+                else if (text[i] == 0xE4 )
+                    {
+                    text[i] = common_lang_constants::LOWER_A;
+                    }
+                else if (text[i] == 0xF6)
+                    {
+                    text[i] = common_lang_constants::LOWER_O;
+                    }
+                else if (text[i] == 0xFC)
+                    {
+                    text[i] = common_lang_constants::LOWER_U;
+                    }
+                }
+            }
+        void italian_acutes_to_graves(string_typeT& text)
+            {
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0xC1)//A acute
+                    {
+                    text[i] = 0xC0;
+                    }
+                else if (text[i] == 0xC9)//E acute
+                    {
+                    text[i] = 0xC8;
+                    }
+                else if (text[i] == 0xCD)//I acute
+                    {
+                    text[i] = 0xCC;
+                    }
+                else if (text[i] == 0xD3)//O acute
+                    {
+                    text[i] = 0xD2;
+                    }
+                else if (text[i] == 0xDA)//U acute
+                    {
+                    text[i] = 0xD9;
+                    }
+                else if (text[i] == 0xE1)//a acute
+                    {
+                    text[i] = 0xE0;
+                    }
+                else if (text[i] == 0xE9)//e acute
+                    {
+                    text[i] = 0xE8;
+                    }
+                else if (text[i] == 0xED)//i acute
+                    {
+                    text[i] = 0xEC;
+                    }
+                else if (text[i] == 0xF3)//o acute
+                    {
+                    text[i] = 0xF2;
+                    }
+                else if (text[i] == 0xFA)//u acute
+                    {
+                    text[i] = 0xF9;
+                    }
+                }
+            }
+        ///Hash initial y, y after a vowel, and i between vowels into hashed character.
+        //----------------------------------------------------------
+        void hash_dutch_yi(string_typeT& text,
+                    const wchar_t* vowel_string)
+            {
+            //need at least 2 letters for hashing
+            if (text.length() < 2)
+                { return; }
+
+            if (text[0] == common_lang_constants::LOWER_Y)
+                {
+                text[0] = LOWER_Y_HASH;
+                }
+            else if (text[0] == common_lang_constants::UPPER_Y)
+                {
+                text[0] = UPPER_Y_HASH;
+                }
+            bool in_vowel_block = string_util::is_one_of(text[0], vowel_string);
+
+            size_t i = 1;
+            for (i = 1; i < text.length()-1; ++i)
+                {
+                if (in_vowel_block &&
+                    text[i] == common_lang_constants::LOWER_I &&
+                    string_util::is_one_of(text[i+1], vowel_string) )
+                    {
+                    text[i] = LOWER_I_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (in_vowel_block &&
+                    text[i] == common_lang_constants::UPPER_I &&
+                    string_util::is_one_of(text[i+1], vowel_string) )
+                    {
+                    text[i] = UPPER_I_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (in_vowel_block &&
+                    text[i] == common_lang_constants::LOWER_Y)
+                    {
+                    text[i] = LOWER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (in_vowel_block &&
+                    text[i] == common_lang_constants::UPPER_Y)
+                    {
+                    text[i] = UPPER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (string_util::is_one_of(text[i], vowel_string) )
+                    {
+                    in_vowel_block = true;
+                    }
+                else
+                    {
+                    in_vowel_block = false;
+                    }
+                }
+            //check the last letter
+            if (in_vowel_block &&
+                text[i] == common_lang_constants::LOWER_Y)
+                {
+                text[i] = LOWER_Y_HASH;
+                in_vowel_block = false;
+                }
+            else if (in_vowel_block &&
+                text[i] == common_lang_constants::UPPER_Y)
+                {
+                text[i] = UPPER_Y_HASH;
+                in_vowel_block = false;
+                }
+            }
+
+        //----------------------------------------------------------
+        inline void unhash_dutch_yi(string_typeT& text)
+            {
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_Y_HASH, common_lang_constants::LOWER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_Y_HASH, common_lang_constants::UPPER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_I_HASH, common_lang_constants::LOWER_I);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_I_HASH, common_lang_constants::UPPER_I);
+            }
+
+        ///Hash 'u' and 'y' between vowels
+        //----------------------------------------------------------
+        void hash_german_yu(string_typeT& text,
+                    const wchar_t* vowel_string)
+            {
+            //need at least 2 letters for hashing
+            if (text.length() < 2)
+                { return; }
+
+            bool in_vowel_block = string_util::is_one_of(text[0], vowel_string);
+
+            for (size_t i = 1; i < text.length()-1; ++i)
+                {
+                if (in_vowel_block &&
+                    string_util::is_one_of(text[i], vowel_string) &&
+                    string_util::is_one_of(text[i+1], vowel_string) )
+                    {
+                    if (text[i] == common_lang_constants::LOWER_Y)
+                        {
+                        text[i] = LOWER_Y_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_Y)
+                        {
+                        text[i] = UPPER_Y_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::LOWER_U)
+                        {
+                        text[i] = LOWER_U_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_U)
+                        {
+                        text[i] = UPPER_U_HASH;
+                        }
+                    }
+                else if (string_util::is_one_of(text[i], vowel_string) )
+                    {
+                    in_vowel_block = true;
+                    }
+                else
+                    {
+                    in_vowel_block = false;
+                    }
+                }
+            //hashable values must be between vowels, so don't bother looking at last letter
+            }
+
+        //----------------------------------------------------------
+        inline void unhash_german_yu(string_typeT& text)
+            {
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_Y_HASH, common_lang_constants::LOWER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_Y_HASH, common_lang_constants::UPPER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_U_HASH, common_lang_constants::LOWER_U);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_U_HASH, common_lang_constants::UPPER_U);
+            }
+
+        /**Hash u or i preceded and followed by a vowel, and y preceded or followed by a vowel.
+        u after q is also hashed. For example,
+        jouer         ->         joUer
+        ennuie         ->         ennuIe
+        yeux         ->         Yeux
+        quand         ->         qUand*/
+        //----------------------------------------------------------
+        void hash_french_yui(string_typeT& text,
+                    const wchar_t* vowel_string)
+            {
+            //need at least 2 letters for hashing
+            if (text.length() < 2)
+                { return; }
+
+            bool in_vowel_block = false;
+
+            //start loop at zero because 'y' at start of string can be hashed
+            size_t i = 0;
+            for (i = 0; i < text.length()-1; ++i)
+                {
+                if (in_vowel_block &&
+                    string_util::is_one_of(text[i], vowel_string) &&
+                    string_util::is_one_of(text[i+1], vowel_string) )
+                    {
+                    if (text[i] == common_lang_constants::LOWER_Y)
+                        {
+                        text[i] = LOWER_Y_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_Y)
+                        {
+                        text[i] = UPPER_Y_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::LOWER_U)
+                        {
+                        text[i] = LOWER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_U)
+                        {
+                        text[i] = UPPER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::LOWER_I)
+                        {
+                        text[i] = LOWER_I_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_I)
+                        {
+                        text[i] = UPPER_I_HASH;
+                        in_vowel_block = false;
+                        }
+                    }
+                //if just previous letter is a vowel then examine for 'y'
+                else if (in_vowel_block &&
+                        text[i] == common_lang_constants::LOWER_Y)
+                    {
+                    text[i] = LOWER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (in_vowel_block &&
+                        text[i] == common_lang_constants::UPPER_Y)
+                    {
+                    text[i] = UPPER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                //if just following letter is a vowel then examine for 'y'
+                else if (text[i] == common_lang_constants::LOWER_Y &&
+                        string_util::is_one_of(text[i+1], vowel_string) &&
+                        is_neither<wchar_t>(text[i+1], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                    {
+                    text[i] = LOWER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (text[i] == common_lang_constants::UPPER_Y &&
+                        string_util::is_one_of(text[i+1], vowel_string) &&
+                        is_neither<wchar_t>(text[i+1], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                    {
+                    text[i] = UPPER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (string_util::is_one_of(text[i], vowel_string) )
+                    {
+                    if (text[i] == common_lang_constants::LOWER_U &&
+                        (i > 0) &&
+                        is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                        {
+                        text[i] = LOWER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_U &&
+                        (i > 0) &&
+                        is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                        {
+                        text[i] = UPPER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else
+                        {
+                        in_vowel_block = true;
+                        }
+                    }
+                else
+                    {
+                    in_vowel_block = false;
+                    }
+                }
+            //verify that the last letter
+            if (text[i] == common_lang_constants::LOWER_Y &&
+                (i > 0) &&
+                string_util::is_one_of(text[i-1], vowel_string)    )
+                {
+                text[i] = LOWER_Y_HASH;
+                }
+            else if (text[i] == common_lang_constants::UPPER_Y &&
+                    (i > 0) &&
+                    string_util::is_one_of(text[i-1], vowel_string) )
+                {
+                text[i] = UPPER_Y_HASH;
+                }
+            else if (text[i] == common_lang_constants::LOWER_U &&
+                    (i > 0) &&
+                    is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                {
+                text[i] = LOWER_U_HASH;
+                }
+            else if (text[i] == common_lang_constants::UPPER_U &&
+                    (i > 0) &&
+                    is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                {
+                text[i] = UPPER_U_HASH;
+                }
+            }
+
+        void unhash_french_yui(string_typeT& text)
+            {
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_Y_HASH, common_lang_constants::LOWER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_Y_HASH, common_lang_constants::UPPER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_U_HASH, common_lang_constants::LOWER_U);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_U_HASH, common_lang_constants::UPPER_U);
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_I_HASH, common_lang_constants::LOWER_I);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_I_HASH, common_lang_constants::UPPER_I);
+            }
+
+        //----------------------------------------------------------
+        void hash_y(string_typeT& text,
+                    const wchar_t* vowel_string)
+            {
+            //need at least 2 letters for hashing
+            if (text.length() < 2)
+                { return; }
+
+            //if first letter is a 'y', then it is likely not a vowel
+            if (text[0] == common_lang_constants::LOWER_Y)
+                {
+                text[0] = LOWER_Y_HASH;
+                }
+            else if (text[0] == common_lang_constants::UPPER_Y)
+                {
+                text[0] = UPPER_Y_HASH;
+                }
+
+            bool in_vowel_block = string_util::is_one_of(text[0], vowel_string);
+
+            for (size_t i = 1; i < text.length(); ++i)
+                {
+                //LOWER_Y after vowel is a consonant
+                if (in_vowel_block &&
+                    text[i] == common_lang_constants::LOWER_Y)
+                    {
+                    text[i] = LOWER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (in_vowel_block &&
+                    text[i] == common_lang_constants::UPPER_Y)
+                    {
+                    text[i] = UPPER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (string_util::is_one_of(text[i], vowel_string) )
+                    {
+                    in_vowel_block = true;
+                    }
+                //we are on a consonant
+                else
+                    {
+                    in_vowel_block = false;
+                    }
+                }
+            }
+
+        //----------------------------------------------------------
+        inline void unhash_y(string_typeT& text)
+            {
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_Y_HASH, common_lang_constants::LOWER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_Y_HASH, common_lang_constants::UPPER_Y);
+            }
+
+        ///Hash u after q, and u, i between vowels
+        //----------------------------------------------------------
+        void hash_italian_ui(string_typeT& text,
+                    const wchar_t* vowel_string)
+            {
+            //need at least 2 letters for hashing
+            if (text.length() < 2)
+                { return; }
+
+            bool in_vowel_block = string_util::is_one_of(text[0], vowel_string);
+
+            size_t i = 1;
+            for (i = 1; i < text.length()-1; ++i)
+                {
+                if (in_vowel_block &&
+                    string_util::is_one_of(text[i], vowel_string) &&
+                    string_util::is_one_of(text[i+1], vowel_string) )
+                    {
+                    if (text[i] == common_lang_constants::LOWER_I )
+                        {
+                        text[i] = LOWER_I_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_I )
+                        {
+                        text[i] = UPPER_I_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::LOWER_U)
+                        {
+                        text[i] = LOWER_U_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_U)
+                        {
+                        text[i] = UPPER_U_HASH;
+                        }
+                    }
+                else if (string_util::is_one_of(text[i], vowel_string) )
+                    {
+                    /*u after q should be encrypted and not be
+                    treated as a vowel*/
+                    if (text[i] == common_lang_constants::LOWER_U &&
+                        (i > 0) &&
+                        is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                        {
+                        text[i] = LOWER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_U &&
+                        (i > 0) &&
+                        is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                        {
+                        text[i] = UPPER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else
+                        {
+                        in_vowel_block = true;
+                        }
+                    }
+                //we are on a consonant
+                else
+                    {
+                    in_vowel_block = false;
+                    }
+                }
+            //verify the last letter
+            if (text[i] == common_lang_constants::LOWER_U &&
+                (i > 0) &&
+                is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                {
+                text[i] = LOWER_U_HASH;
+                }
+            else if (text[i] == common_lang_constants::UPPER_U &&
+                (i > 0) &&
+                is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                {
+                text[i] = UPPER_U_HASH;
+                }
+            }
+
+        //----------------------------------------------------------
+        inline void unhash_italian_ui(string_typeT& text)
+            {
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_I_HASH, common_lang_constants::LOWER_I);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_I_HASH, common_lang_constants::UPPER_I);
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_U_HASH, common_lang_constants::LOWER_U);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_U_HASH, common_lang_constants::UPPER_U);
+            }
+
+        //----------------------------------------------------------
+        void remove_dutch_umlauts(string_typeT& text)
+            {
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0xC4)
+                    {
+                    text[i] = common_lang_constants::UPPER_A;
+                    }
+                else if (text[i] == 0xCB)
+                    {
+                    text[i] = common_lang_constants::UPPER_E;
+                    }
+                else if (text[i] == 0xCF)
+                    {
+                    text[i] = common_lang_constants::UPPER_I;
+                    }
+                else if (text[i] == 0xD6)
+                    {
+                    text[i] = common_lang_constants::UPPER_O;
+                    }
+                else if (text[i] == 0xDC)
+                    {
+                    text[i] = common_lang_constants::UPPER_U;
+                    }
+                else if (text[i] == 0xE4)
+                    {
+                    text[i] = common_lang_constants::LOWER_A;
+                    }
+                else if (text[i] == 0xEB)
+                    {
+                    text[i] = common_lang_constants::LOWER_E;
+                    }
+                else if (text[i] == 0xEF)
+                    {
+                    text[i] = common_lang_constants::LOWER_I;
+                    }
+                else if (text[i] == 0xF6)
+                    {
+                    text[i] = common_lang_constants::LOWER_O;
+                    }
+                else if (text[i] == 0xFC)
+                    {
+                    text[i] = common_lang_constants::LOWER_U;
+                    }
+                }
+            }
+
+        //----------------------------------------------------------
+        void remove_dutch_acutes(string_typeT& text)
+            {
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0xC1)
+                    {
+                    text[i] = common_lang_constants::UPPER_A;
+                    }
+                else if (text[i] == 0xC9)
+                    {
+                    text[i] = common_lang_constants::UPPER_E;
+                    }
+                else if (text[i] == 0xCD)
+                    {
+                    text[i] = common_lang_constants::UPPER_I;
+                    }
+                else if (text[i] == 0xD3)
+                    {
+                    text[i] = common_lang_constants::UPPER_O;
+                    }
+                else if (text[i] == 0xDA)
+                    {
+                    text[i] = common_lang_constants::UPPER_U;
+                    }
+                else if (text[i] == 0xE1)
+                    {
+                    text[i] = common_lang_constants::LOWER_A;
+                    }
+                else if (text[i] == 0xE9)
+                    {
+                    text[i] = common_lang_constants::LOWER_E;
+                    }
+                else if (text[i] == 0xED)
+                    {
+                    text[i] = common_lang_constants::LOWER_I;
+                    }
+                else if (text[i] == 0xF3)
+                    {
+                    text[i] = common_lang_constants::LOWER_O;
+                    }
+                else if (text[i] == 0xFA)
+                    {
+                    text[i] = common_lang_constants::LOWER_U;
+                    }
+                }
+            }
+
+        //----------------------------------------------------------
+        void remove_spanish_acutes(string_typeT& text)
+            {
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0xC1)
+                    {
+                    text[i] = common_lang_constants::UPPER_A;
+                    }
+                else if (text[i] == 0xC9)
+                    {
+                    text[i] = common_lang_constants::UPPER_E;
+                    }
+                else if (text[i] == 0xCD)
+                    {
+                    text[i] = common_lang_constants::UPPER_I;
+                    }
+                else if (text[i] == 0xD3)
+                    {
+                    text[i] = common_lang_constants::UPPER_O;
+                    }
+                else if (text[i] == 0xDA)
+                    {
+                    text[i] = common_lang_constants::UPPER_U;
+                    }
+                else if (text[i] == 0xE1)
+                    {
+                    text[i] = common_lang_constants::LOWER_A;
+                    }
+                else if (text[i] == 0xE9)
+                    {
+                    text[i] = common_lang_constants::LOWER_E;
+                    }
+                else if (text[i] == 0xED)
+                    {
+                    text[i] = common_lang_constants::LOWER_I;
+                    }
+                else if (text[i] == 0xF3)
+                    {
+                    text[i] = common_lang_constants::LOWER_O;
+                    }
+                else if (text[i] == 0xFA)
+                    {
+                    text[i] = common_lang_constants::LOWER_U;
+                    }
+                }
+            }
+
+        inline size_t get_r1() const
+            { return m_r1; }
+        inline void set_r1(const size_t val)
+            { m_r1 = val; }
+
+        inline size_t get_r2() const
+            { return m_r2; }
+        inline void set_r2(const size_t val)
+            { m_r2 = val; }
+
+        inline size_t get_rv() const
+            { return m_rv; }
+        inline void set_rv(const size_t val)
+            { m_rv = val; }
+
+        void reset_r_values()
+            { m_r1 = m_r2 = m_rv = 0; }
+    private:
+        size_t m_r1;
+        size_t m_r2;
+        //only used for romance/russian languages
+        size_t m_rv;
+        };
+
+    //------------------------------------------------------
+    /*A non-operational stemmer that is used in place of regular stemmers when
+    you don't want the system to actually stem anything.*/
+    template <typename string_typeT = std::wstring>
+    class no_op_stem
+        {
+    public:
+        ///No-op stemming of declared string type
+        inline void operator()(const string_typeT&) const
+            {}
+        ///No-op stemming of flexible string type
+        template <typename T>
+        inline void operator()(const T&) const
+            {}
+        };
+    }
+
+#endif //__STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/stemming/swedish_stem.h b/third-party/OleanderStemmingLibrary/stemming/swedish_stem.h
new file mode 100644 (file)
index 0000000..9e6d5e4
--- /dev/null
@@ -0,0 +1,330 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __SWEDISH_STEM_H__
+#define __SWEDISH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class swedish_stem
+        Swedish stemming class.
+
+    The Swedish alphabet includes the following additional letters,
+        - ä   å   ö
+
+    The following letters are vowels:
+        - a   e   i   o   u   y   ä   å   ö
+
+    R2 is not used: R1 is defined in the same way as in the German stemmer.
+
+    Define a valid s-ending as one of:
+        - b c d f g h j k l m n o p r t v y
+    
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated.
+        - a   arna   erna   heterna   orna   ad   e   ade   ande   arne   are   aste   en   anden
+              aren   heten   ern   ar   er   heter   or   as   arnas   ernas   ornas   es   ades
+              andes   ens   arens   hetens   erns   at   andet   het   ast
+            - Delete.
+        - s
+         - Delete if preceded by a valid s-ending.
+
+    (Of course the letter of the valid s-ending is not necessarily in R1).
+
+    <b>Step 2:</b>
+
+    Search for one of the following suffixes in R1, and if found delete the last letter. 
+        - dd   gd   nn   dt   gt   kt   tt 
+
+    (For example, friskt -> frisk, fröknarnn -> fröknarn).
+    
+    <b>Step 2:</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated.
+        - lig   ig   els 
+            - Delete 
+        - löst 
+            - Replace with lös 
+        - fullt 
+            - Replace with full
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class swedish_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                return;
+                }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //see where the R1 section begins
+            //R1 is the first consonant after the first vowel
+            stem<string_typeT>::find_r1(text, SWEDISH_VOWELS);
+            if (stem<string_typeT>::get_r1() == text.length())
+                {
+                return;
+                }
+
+            //R1 must have at least 3 characters in front of it
+            if (stem<string_typeT>::get_r1() < 3)
+                {
+                stem<string_typeT>::set_r1(3);    
+                }
+            //swedish does not use R2
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*heterna*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*hetens*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*arna*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erna*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*orna*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ande*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*arne*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*aste*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*anden*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heten*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heter*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*arnas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ernas*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ornas*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*arens*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*andet*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*andes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*aren*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, /*erns*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ades*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*are*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ade*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*het*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ast*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, /*ens*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ern*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*or*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ad*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*as*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ar*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 2 &&
+                    string_util::is_one_of(text[text.length()-2],
+                    L"bcdfghjklmnoprtvyBCDFGHJKLMNOPRTVY") )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*dd*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*gd*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*nn*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*dt*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*gt*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*kt*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*tt*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*fullt*/common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*löst*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O_UMLAUTS, common_lang_constants::UPPER_O_UMLAUTS, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*lig*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*els*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            }
+        };
+    }
+
+#endif //__SWEDISH_STEM_H__
diff --git a/third-party/OleanderStemmingLibrary/utilities/debug_logic.h b/third-party/OleanderStemmingLibrary/utilities/debug_logic.h
new file mode 100644 (file)
index 0000000..5ab19f1
--- /dev/null
@@ -0,0 +1,79 @@
+/**
+\date 2008-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __DEBUG_LOGIC_H__
+#define __DEBUG_LOGIC_H__
+
+#include <iostream>
+#include <fstream>
+#include <iterator>
+
+/** \addtogroup Debugging
+   * Functions used for debugging.
+   * @{*/
+/**
+\def __DEBUG_FUNCTION_NAME__
+    Expands to the name of the current function. Will not be defined if
+    compiler does not have a native function name macro.
+\def CASSERT(expression)
+    Validates that an expression is true at compile time. If the expression is false
+    then compilation will fail.
+\def NON_UNIT_TEST_ASSERT(expression)
+    If unit test symbol (__UNITTEST) is defined then does nothing; otherwise asserts.
+    This is useful for suppressing asserts when unit testing.
+\def DUMP_TO_FILE(stream,file)
+    Prints data stream to a specified file.*/
+/** @} */
+
+#ifdef __PRETTY_FUNCTION__
+    #define __DEBUG_FUNCTION_NAME__ __PRETTY_FUNCTION__
+#elif defined(__FUNCTION__)
+    #define __DEBUG_FUNCTION_NAME__ __FUNCTION__
+#elif defined(__func__)
+    #define __DEBUG_FUNCTION_NAME__ __func__
+#elif defined(__FUNCSIG__)
+    #define __DEBUG_FUNCTION_NAME__ __FUNCSIG__
+#elif defined(__FUNCDNAME__)
+    #define __DEBUG_FUNCTION_NAME__ __FUNCDNAME__
+#endif
+
+//----------------------------------------------------------------------
+#if !defined (NDEBUG) || defined ENABLE_LOGIC_CHECKS || defined DEBUG_ENABLE_ALL
+    #define CASSERT(x) typedef char __C_ASSERT__[(x) ? 1 : -1]
+#else
+    #define CASSERT(x) ((void)0)
+#endif
+
+//----------------------------------------------------------------------
+#ifdef __UNITTEST
+    #define NON_UNIT_TEST_ASSERT(x) ((void)0)
+#else
+    #define NON_UNIT_TEST_ASSERT(x) assert(x)
+#endif
+
+//----------------------------------------------------------------------
+#if !defined (NDEBUG) || defined DEBUG_ENABLE_ALL
+    #define DUMP_TO_FILE(x,file) __debug::__dump_to_file((x), (file))
+#else
+    #define DUMP_TO_FILE(x,file) ((void)0)
+#endif
+
+//----------------------------------------------------------------------
+namespace __debug
+    {
+    //debug helpers
+    inline void __dump_to_file(const wchar_t* begin, const std::string& file_path)
+        {
+        if (begin == NULL)
+            { return; }
+        std::wofstream f(file_path.c_str());
+        f.write(begin, static_cast<std::streamsize>(std::wcslen(begin)));
+        }
+    }
+
+#endif //__DEBUG_LOGIC_H__
diff --git a/third-party/OleanderStemmingLibrary/utilities/safe_math.h b/third-party/OleanderStemmingLibrary/utilities/safe_math.h
new file mode 100644 (file)
index 0000000..87acba1
--- /dev/null
@@ -0,0 +1,117 @@
+/** \addtogroup Mathematics
+   * Math and statistics classes.
+* @{*/
+/**
+\date 2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __SAFE_MATH_H__
+#define __SAFE_MATH_H__
+
+#include <cmath>
+#include <cassert>
+#include <functional>
+
+//DIVISION OPERATIONS
+//-------------------
+
+///Modulus operation that checks for modulus by zero or into zero (returns zero for those situations).
+///@param dividend The dividend (i.e., the value being divided).
+///@param divisor The divisor (i.e., the value dividing by).
+///@returns The remainder of the modulus operation, or zero if one of the values was invalid.
+template<typename T>
+inline T safe_modulus(const T dividend, const T divisor)
+    {
+    if (dividend == 0 || divisor == 0)
+        { return 0; }
+    return dividend%divisor;
+    }
+
+///Division operation that checks for division by zero or into zero (returns zero for those situations).
+///@param dividend The dividend (i.e., the value being divided).
+///@param divisor The divisor (i.e., the value dividing by).
+///@returns The quotient of the division operation, or zero if one of the values was invalid.
+///@note If the template type has a floating point precision, then the result will retain its precision.
+template<typename T>
+inline T safe_divide(const T dividend, const T divisor)
+    {
+    if (dividend == 0 || divisor == 0)
+        { return 0; }
+    return dividend/static_cast<T>(divisor);
+    }
+
+//DOUBLE OPERATIONS
+//-----------------
+
+/**Compares two double values (given the specified precision).
+   @param actual The value being reviewed.
+   @param expected The expected value to compare against.
+   @param delta The tolerance of how different the values can be. The larger the delta, the
+   higher precision used in the comparison.
+   @returns True if the value matches the expected value.*/
+inline bool compare_doubles(const double actual, const double expected, const double delta = 1e-6)
+    {
+    assert(delta >= 0 && "delta value should be positive when comparing doubles");
+    return (std::fabs(actual-expected) <= std::fabs(delta));
+    }
+
+/**Compares two double values for less than (given the specified precision).
+   @param left The value being reviewed.
+   @param right The other value to compare against.
+   @param delta The tolerance of how different the values can be. The larger the delta, the
+   higher precision used in the comparison.
+   @returns True if the value is less than the other value.*/
+inline bool compare_doubles_less(const double left, const double right, const double delta = 1e-6)
+    {
+    assert(delta >= 0 && "delta value should be positive when comparing doubles");
+       return std::fabs(left-right) > std::fabs(delta) && (left < right);
+    }
+
+/**Compares two double values for less than or equal to (given the specified precision).
+   @param left The value being reviewed.
+   @param right The other value to compare against.
+   @param delta The tolerance of how different the values can be. The larger the delta, the
+   higher precision used in the comparison.
+   @returns True if the value is less than or equal to the other value.*/
+inline bool compare_doubles_less_or_equal(const double left, const double right, const double delta = 1e-6)
+    {
+    assert(delta >= 0 && "delta value should be positive when comparing doubles");
+       return compare_doubles_less(left,right,delta) || compare_doubles(left,right,delta);
+    }
+
+/**Compares two double values for greater than (given the specified precision).
+   @param left The value being reviewed.
+   @param right The other value to compare against.
+   @param delta The tolerance of how different the values can be. The larger the delta, the
+   higher precision used in the comparison.
+   @returns True if the value is greater than the other value.*/
+inline bool compare_doubles_greater(const double left, const double right, const double delta = 1e-6)
+    {
+    assert(delta >= 0 && "delta value should be positive when comparing doubles");
+       return std::fabs(left-right) > std::fabs(delta) && (left > right);
+    }
+
+///"less" interface for double values.
+class double_less : public std::binary_function<double, double, bool>
+    {
+public:
+    inline bool operator()(const double& left, const double& right) const
+        { return compare_doubles_less(left,right); }
+    };
+
+//INTEGER OPERATIONS
+//------------------
+
+///Converts an integral type to a boolean. Compilers complain about directly assigning
+///an int to a bool (casting doesn't help either), so this works around that.
+///@param intVal The integer value to convert to a boolean.
+///@returns The boolean equivalent of the integer.
+template<typename T>
+inline bool int_to_bool(const T intVal)
+    { return (intVal != 0); }
+
+#endif //__SAFE_MATH_H__
diff --git a/third-party/OleanderStemmingLibrary/utilities/utilities.h b/third-party/OleanderStemmingLibrary/utilities/utilities.h
new file mode 100644 (file)
index 0000000..8424026
--- /dev/null
@@ -0,0 +1,156 @@
+/**
+\date 2003-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __UTILITIES_H__
+#define __UTILITIES_H__
+
+#include <algorithm>
+#include <functional>
+#include <cmath>
+#include <cassert>
+
+///@returns the item count of an array.
+#define size_of_array(x) (sizeof(x)/sizeof(x[0]))
+
+/**Range checks a given value and truncates it if it is too high or low.
+   @param start The start of the valid range.
+   @param end The end of the valid range.
+   @param value The value to be range checked.
+   @returns The value if within the valid range. If it was too large, then the end of the range
+   is returned. If too low, then the start of the range is returned.*/
+template<typename T>
+inline T within_range(const T start, const T end, const T value)
+    {
+    return ( (value >= start) && (value <= end) ) ? value :
+            (value < start) ? start :
+            (value > end) ? end : /*never reaches this branch*/ value;
+    }
+
+///pair interface that compares on the first item
+template<typename T1, typename T2>
+class comparable_first_pair : public std::pair<T1,T2>
+    {
+public:
+    comparable_first_pair() : std::pair<T1,T2>() {}
+    comparable_first_pair(const T1& t1, const T2& t2) : std::pair<T1,T2>(t1,t2) {}
+    bool operator<(const comparable_first_pair<T1,T2>& that) const
+        { return std::pair<T1,T2>::first < that.first; }
+    bool operator==(const comparable_first_pair<T1,T2>& that) const
+        { return std::pair<T1,T2>::first == that.first; }
+    };
+
+///class that remembers its original value from construction.
+template <typename T>
+class backup_variable
+    {
+public:
+    backup_variable(const T& value) : m_originalValue(value), m_value(value)
+        {}
+    void operator=(const T& value)
+        { m_value = value; }
+    bool operator==(const T& value) const
+        { return m_value == value; }
+    bool operator<(const T& value) const
+        { return m_value < value; }
+    bool operator<=(const T& value) const
+        { return m_value <= value; }
+    bool operator>(const T& value) const
+        { return m_value > value; }
+    bool operator>=(const T& value) const
+        { return m_value >= value; }
+    void operator+(const T& value)
+        { m_value + value; }
+    void operator+=(const T& value)
+        { m_value += value; }
+    void operator-(const T& value)
+        { m_value - value; }
+    void operator-=(const T& value)
+        { m_value -= value; }
+    operator const T() const
+        { return m_value; }
+    T* operator&()
+        { return &m_value; }
+    const T& get_value() const
+        { return m_value; }
+    T& get_value()
+        { return m_value; }
+    bool has_changed() const
+        { return m_value != m_originalValue; }
+private:
+    T m_originalValue;
+    T m_value;
+    };
+
+///Determines if a given value is either of two other given values
+template<typename T>
+inline bool is_either(const T value, const T first, const T second)
+    {
+    return (value == first || value == second);
+    }
+
+///Determines if a given value is neither of two other given values
+template<typename T>
+inline bool is_neither(const T value, const T first, const T second)
+    {
+    assert(first != second);
+    return (value != first && value != second);
+    }
+
+///determines if a value is within a given range
+template<typename T>
+inline bool is_within(const T value, const T first, const T second)
+    {
+    assert(first <= second);
+    return (value >= first && value <= second);
+    }
+
+/**calls a member function of elements in a container for each
+element in another container*/
+template<typename inT, typename outT, typename member_extract_functorT>
+inline outT copy_member(inT begin, inT end, outT dest, member_extract_functorT get_value)
+    {
+    for (; begin != end; ++dest, ++begin)
+        *dest = get_value(*begin);
+    return (dest);
+    }
+
+///Copies a member value between objects based on specified criteria
+template<typename inT, typename outT,
+         typename _Pr,
+         typename member_extract_functorT>
+inline outT copy_member_if(inT begin, inT end, outT dest,
+                           _Pr meets_criteria,
+                           member_extract_functorT get_value)
+    {
+    for (; begin != end; ++begin)
+        {
+        if (meets_criteria(*begin))
+            {
+            *dest = get_value(*begin);
+            ++dest;
+            }
+        }
+    return (dest);
+    }
+
+///determines if a value is within a given range
+template<typename T>
+class within : public std::unary_function<T, bool>
+    {
+public:
+    within(T range_begin, T range_end)
+        : m_range_begin(range_begin), m_range_end(range_end)
+        {}
+    inline bool operator()(T value) const
+        { return is_within(value, m_range_begin, m_range_end); }
+private:
+    T m_range_begin;
+    T m_range_end;
+    };
+
+#endif //__UTILITIES_H__
diff --git a/third-party/include/OleanderStemmingLibrary/indexing/common_lang_constants.h b/third-party/include/OleanderStemmingLibrary/indexing/common_lang_constants.h
new file mode 100644 (file)
index 0000000..34801b3
--- /dev/null
@@ -0,0 +1,185 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __COMMON_LANG_CONSTANTS_H__
+#define __COMMON_LANG_CONSTANTS_H__
+
+#include <cwctype>
+
+namespace common_lang_constants
+    {
+    /** \addtogroup Indexing
+    * Punctuation constants.
+    * @{*/
+    const wchar_t TAB = 0x09;
+    const wchar_t SPACE = 0x20;
+    const wchar_t COMMA = 0x2C;
+    const wchar_t LESS_THAN = 60;
+    const wchar_t GREATER_THAN = 62;
+    const wchar_t POUND = 35;
+    const wchar_t AMPERSAND = 38;
+    const wchar_t SEMICOLON = 59;
+    const wchar_t APOSTROPHE = 0x27;
+    const wchar_t DOUBLE_QUOTE = 0x22;
+    const wchar_t QUESTION_MARK = 0x3F;
+    const wchar_t QUESTION_MARK_FULL_WIDTH = 0xFF1F;
+    const wchar_t PERIOD = 0x2E;
+    const wchar_t PERIOD_FULL_WIDTH = 0xFF0E;
+    const wchar_t PERIOD_HALF_WIDTH = 0xFF61;
+    const wchar_t EXCLAMATION_MARK = 0x21;
+    const wchar_t EXCLAMATION_MARK_FULL_WIDTH = 0xFF01;
+    const wchar_t COLON = 0x3A;
+    const wchar_t FORWARD_SLASH = 0x2F;
+    const wchar_t BACK_SLASH = 0x5C;
+    const wchar_t DOLLAR_SIGN = 0x24;
+    const wchar_t PERCENTAGE_SIGN = 0x25;
+    const wchar_t HYPHEN = 0x2D;
+    const wchar_t SOFT_HYPHEN = 0xAD;
+    const wchar_t LEFT_PARENTHESIS = 0x28;
+    const wchar_t LEFT_PARENTHESIS_FULL_WIDTH = 0xFF08;
+    const wchar_t RIGHT_PARENTHESIS = 0x29;
+    const wchar_t RIGHT_PARENTHESIS_FULL_WIDTH = 0xFF09;
+    const wchar_t RIGHT_BRACKET = 0x5D;
+    const wchar_t INTERROBANG = 0x203D;
+    //numbers
+    const wchar_t NUMBER_0 = 0x30;
+    const wchar_t NUMBER_1 = 0x31;
+    const wchar_t NUMBER_2 = 0x32;
+    const wchar_t NUMBER_3 = 0x33;
+    const wchar_t NUMBER_4 = 0x34;
+    const wchar_t NUMBER_5 = 0x35;
+    const wchar_t NUMBER_6 = 0x36;
+    const wchar_t NUMBER_7 = 0x37;
+    const wchar_t NUMBER_8 = 0x38;
+    const wchar_t NUMBER_9 = 0x39;
+    const wchar_t NUMBER_0_FULL_WIDTH = 0xFF10;
+    const wchar_t NUMBER_1_FULL_WIDTH = 0xFF11;
+    const wchar_t NUMBER_2_FULL_WIDTH = 0xFF12;
+    const wchar_t NUMBER_3_FULL_WIDTH = 0xFF13;
+    const wchar_t NUMBER_4_FULL_WIDTH = 0xFF14;
+    const wchar_t NUMBER_5_FULL_WIDTH = 0xFF15;
+    const wchar_t NUMBER_6_FULL_WIDTH = 0xFF16;
+    const wchar_t NUMBER_7_FULL_WIDTH = 0xFF17;
+    const wchar_t NUMBER_8_FULL_WIDTH = 0xFF18;
+    const wchar_t NUMBER_9_FULL_WIDTH = 0xFF19;
+    //constants for letters
+    const wchar_t UPPER_A = 0x41;
+    const wchar_t LOWER_A = 0x61;
+    const wchar_t UPPER_B = 0x42;
+    const wchar_t LOWER_B = 0x62;
+    const wchar_t UPPER_C = 0x43;
+    const wchar_t LOWER_C = 0x63;
+    const wchar_t UPPER_D = 0x44;
+    const wchar_t LOWER_D = 0x64;
+    const wchar_t UPPER_E = 0x45;
+    const wchar_t LOWER_E = 0x65;
+    const wchar_t UPPER_F = 0x46;
+    const wchar_t LOWER_F = 0x66;
+    const wchar_t UPPER_G = 0x47;
+    const wchar_t LOWER_G = 0x67;
+    const wchar_t UPPER_H = 0x48;
+    const wchar_t LOWER_H = 0x68;
+    const wchar_t UPPER_I = 0x49;
+    const wchar_t LOWER_I = 0x69;
+    const wchar_t UPPER_J = 0x4A;
+    const wchar_t LOWER_J = 0x6A;
+    const wchar_t UPPER_K = 0x4B;
+    const wchar_t LOWER_K = 0x6B;
+    const wchar_t UPPER_L = 0x4C;
+    const wchar_t LOWER_L = 0x6C;
+    const wchar_t UPPER_M = 0x4D;
+    const wchar_t LOWER_M = 0x6D;
+    const wchar_t UPPER_N = 0x4E;
+    const wchar_t LOWER_N = 0x6E;
+    const wchar_t UPPER_O = 0x4F;
+    const wchar_t LOWER_O = 0x6F;
+    const wchar_t UPPER_P = 0x50;
+    const wchar_t LOWER_P = 0x70;
+    const wchar_t UPPER_Q = 0x51;
+    const wchar_t LOWER_Q = 0x71;
+    const wchar_t UPPER_R = 0x52;
+    const wchar_t LOWER_R = 0x72;
+    const wchar_t UPPER_S = 0x53;
+    const wchar_t LOWER_S = 0x73;
+    const wchar_t UPPER_T = 0x54;
+    const wchar_t LOWER_T = 0x74;
+    const wchar_t UPPER_U = 0x55;
+    const wchar_t LOWER_U = 0x75;
+    const wchar_t UPPER_V = 0x56;
+    const wchar_t LOWER_V = 0x76;
+    const wchar_t UPPER_W = 0x57;
+    const wchar_t LOWER_W = 0x77;
+    const wchar_t UPPER_X = 0x58;
+    const wchar_t LOWER_X = 0x78;
+    const wchar_t UPPER_Y = 0x59;
+    const wchar_t LOWER_Y = 0x79;
+    const wchar_t UPPER_Z = 0x5A;
+    const wchar_t LOWER_Z = 0x7A;
+
+    const wchar_t UPPER_A_ACUTE = 0xC1;
+    const wchar_t LOWER_A_ACUTE = 0xE1;
+    const wchar_t UPPER_E_ACUTE = 0xC9;
+    const wchar_t LOWER_E_ACUTE = 0xE9;
+    const wchar_t UPPER_I_ACUTE = 0xCD;
+    const wchar_t LOWER_I_ACUTE = 0xED;
+    const wchar_t UPPER_O_ACUTE = 0xD3;
+    const wchar_t LOWER_O_ACUTE = 0xF3;
+    const wchar_t LOWER_U_ACUTE = 0xFA;
+    const wchar_t UPPER_U_ACUTE = 0xDA;
+    const wchar_t UPPER_A_CIRCUMFLEX = 0xC2;
+    const wchar_t LOWER_A_CIRCUMFLEX = 0xE2;
+    const wchar_t UPPER_E_CIRCUMFLEX = 0xCA;
+    const wchar_t LOWER_E_CIRCUMFLEX = 0xEA;
+    const wchar_t UPPER_I_CIRCUMFLEX = 0xCE;
+    const wchar_t LOWER_I_CIRCUMFLEX = 0xEE;
+    const wchar_t UPPER_A_TILDE = 0xC3;
+    const wchar_t LOWER_A_TILDE = 0xE3;
+    const wchar_t UPPER_O_TILDE = 0xD5;
+    const wchar_t LOWER_O_TILDE = 0xF5;
+    const wchar_t UPPER_N_TILDE = 0xD1;
+    const wchar_t LOWER_N_TILDE = 0xF1;
+    const wchar_t UPPER_O_STROKE = 0xD8;
+    const wchar_t LOWER_O_STROKE = 0xF8;
+    const wchar_t UPPER_C_CEDILLA = 0xC7;
+    const wchar_t LOWER_C_CEDILLA = 0xE7;
+    const wchar_t UPPER_A_UMLAUTS = 0xC4;
+    const wchar_t LOWER_A_UMLAUTS = 0xE4;
+    const wchar_t UPPER_O_UMLAUTS = 0xD6;
+    const wchar_t LOWER_O_UMLAUTS = 0xF6;
+    const wchar_t UPPER_E_UMLAUTS = 0xCB;
+    const wchar_t LOWER_E_UMLAUTS = 0xEB;
+    const wchar_t UPPER_I_UMLAUTS = 0xCF;
+    const wchar_t LOWER_I_UMLAUTS = 0xEF;
+    const wchar_t UPPER_ETH = 0xD0;
+    const wchar_t LOWER_ETH = 0xF0;
+    const wchar_t UPPER_U_UMLAUTS = 0xDC;
+    const wchar_t LOWER_U_UMLAUTS = 0xFC;
+    const wchar_t TILDE = 0x7E;
+    const wchar_t UPPER_A_GRAVE = 0xC0;
+    const wchar_t LOWER_A_GRAVE = 0xE0;
+    const wchar_t UPPER_E_GRAVE = 0xC8;
+    const wchar_t LOWER_E_GRAVE = 0xE8;
+    const wchar_t UPPER_I_GRAVE = 0xCC;
+    const wchar_t LOWER_I_GRAVE = 0xEC;
+    const wchar_t UPPER_O_GRAVE = 0xD2;
+    const wchar_t LOWER_O_GRAVE = 0xF2;
+    const wchar_t UPPER_Y_ACUTE = 0xDD;
+    const wchar_t LOWER_Y_ACUTE = 0xFD;
+    const wchar_t ESZETT = 0xDF; //a.k.a. "sharp s"
+    const wchar_t Y_UMLAUT = 0xFF;
+    const wchar_t ELLIPSE = 0x2026;
+    const wchar_t COMPOUND_WORD_SEPARATORS[5] = { HYPHEN, SOFT_HYPHEN, FORWARD_SLASH, BACK_SLASH, 0 };
+    const wchar_t NUMBERS_AND_DOT[22] = {
+        NUMBER_0, NUMBER_1, NUMBER_2, NUMBER_3, NUMBER_4,
+        NUMBER_5, NUMBER_6, NUMBER_7, NUMBER_8, NUMBER_9,
+        NUMBER_0_FULL_WIDTH, NUMBER_1_FULL_WIDTH, NUMBER_2_FULL_WIDTH, NUMBER_3_FULL_WIDTH, NUMBER_4_FULL_WIDTH,
+        NUMBER_5_FULL_WIDTH, NUMBER_6_FULL_WIDTH, NUMBER_7_FULL_WIDTH, NUMBER_8_FULL_WIDTH, NUMBER_9_FULL_WIDTH,
+        PERIOD, 0 };
+    }
+
+#endif //__COMMON_LANG_CONSTANTS_H__
diff --git a/third-party/include/OleanderStemmingLibrary/indexing/string_util.h b/third-party/include/OleanderStemmingLibrary/indexing/string_util.h
new file mode 100644 (file)
index 0000000..526a03b
--- /dev/null
@@ -0,0 +1,1232 @@
+/**
+\date 2003-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __STRING_UTIL_H__
+#define __STRING_UTIL_H__
+
+#include <cstdio>
+#include <cstdlib>
+#include <memory>
+#include <cwctype>
+#include <cctype>
+#include <cstring>
+#include <cwchar>
+#include <cstddef>
+#include <string>
+#include <functional>
+#include <cassert>
+#include <clocale>
+#include <stdexcept>
+#include "common_lang_constants.h"
+#include "../utilities/safe_math.h"
+#include "../utilities/utilities.h"
+#include "../utilities/debug_logic.h"
+
+namespace string_util
+    {
+    ///lowercases any Western European alphabetic characters
+    inline wchar_t tolower_western(const wchar_t c)
+        {
+        return ((c >= L'A') && (c <= L'Z')) ||
+            ((c >= 0xC0) && (c <= 0xD6)) ||
+            ((c >= 0xD8) && (c <= 0xDE))
+                ? (c + 32) : c;
+        }
+
+    ///ANSI C decorators
+    ///strtol
+    inline double strtol(const char* str, char** strend, int radix)
+        { return std::strtol(str, strend, radix); }
+    inline double strtol(const wchar_t* str, wchar_t** strend, int radix)
+        { return std::wcstol(str, strend, radix); }
+    ///strtod
+    inline double strtod(const char* str, char** strend)
+        { return std::strtod(str, strend); }
+    inline double strtod(const wchar_t* str, wchar_t** strend)
+        { return std::wcstod(str, strend); }
+    ///atoi
+    inline int atoi(const char* str)
+        {
+        if (str == NULL)
+            { return 0; }
+        return std::atoi(str);
+        }
+    inline int atoi(const wchar_t* str)
+        {
+        if (str == NULL)
+            { return 0; }
+        wchar_t* dummy = NULL;
+        return static_cast<int>(std::wcstol(str, &dummy, 10));
+        }
+    ///atol
+    inline long atol(const char* str)
+        {
+        if (str == NULL)
+            { return 0; }
+        return std::atol(str);
+        }
+    inline long atol(const wchar_t* str)
+        {
+        if (str == NULL)
+            { return 0; }
+        wchar_t* dummy = NULL;
+        return std::wcstol(str, &dummy, 10);
+        }
+    ///tolower
+    inline int tolower(char c)
+        {
+        return std::tolower(static_cast<unsigned char>(c));
+        }
+    inline wchar_t tolower(wchar_t c)
+        {
+        return std::towlower(c);
+        }
+    ///toupper
+    inline int toupper(char c)
+        {
+        return std::toupper(static_cast<unsigned char>(c));
+        }
+    inline wchar_t toupper(wchar_t c)
+        {
+        return std::towupper(c);
+        }
+    ///memset
+    template<typename T>
+    inline T* memset(T* dest, int c, size_t count)
+        {
+        return static_cast<T*>(std::memset(dest, c, count));
+        }
+    //partial specialized versions of memset
+    inline char* memset(char* dest, int c, size_t count)
+        {
+        return static_cast<char*>(std::memset(dest, c, count));
+        }
+    inline wchar_t* memset(wchar_t* dest, int c, size_t count)
+        {
+        return std::wmemset(dest, static_cast<wchar_t>(c), count);
+        }
+    ///strchr
+    inline const char* strchr(const char* s, int ch)
+        {
+        return std::strchr(s, ch);
+        }
+    inline const wchar_t* strchr(const wchar_t* s, wchar_t ch)
+        {
+        return std::wcschr(s, ch);
+        }
+    ///strstr
+    inline const char* strstr(const char* s1, const char* s2)
+        {
+        return std::strstr(s1, s2);
+        }
+    inline const wchar_t* strstr(const wchar_t* s1, const wchar_t* s2)
+        {
+        return std::wcsstr(s1, s2);
+        }
+    ///strcspn
+    inline size_t strcspn(const char* string1,const char* string2)
+        {
+        return std::strcspn(string1, string2);
+        }
+    inline size_t strcspn(const wchar_t* string1,const wchar_t* string2)
+        {
+        return std::wcscspn(string1, string2);
+        }
+    ///strncat
+    inline char* strncat(char* strDest, const char* strSource, size_t count)
+        {
+        return std::strncat(strDest, strSource, count);
+        }
+    inline wchar_t* strncat(wchar_t* strDest, const wchar_t* strSource, size_t count)
+        {
+        return std::wcsncat(strDest, strSource, count);
+        }
+    ///wctomb
+    inline int wctomb(wchar_t* s, wchar_t wc)
+        {
+        s[0] = wc;
+        return -1;
+        }
+    inline int wctomb(char* s, wchar_t wc)
+        {
+        return std::wctomb(s, wc);
+        }
+    //strlen
+    inline size_t strlen(const char* text) { return std::strlen(text); }
+    inline size_t strlen(const wchar_t* text)
+        { return std::wcslen(text); }
+    ///strcmp
+    inline int strcmp(const char* string1, const char* string2)
+        {
+        return std::strcmp(string1, string2);
+        }
+    inline int strcmp(const wchar_t* string1, const wchar_t* string2)
+        {
+        return std::wcscmp(string1, string2);
+        }
+    ///strncmp
+    inline int strncmp(const char* string1, const char* string2, size_t count)
+        {
+        return std::strncmp(string1, string2, count);
+        }
+    inline int strncmp(const wchar_t* string1, const wchar_t* string2, size_t count)
+        {
+        return std::wcsncmp(string1, string2, count);
+        }
+    ///strncpy
+    inline char* strncpy(char* strDest, const char* strSource, size_t count)
+        {
+        return std::strncpy(strDest, strSource, count);
+        }
+    inline wchar_t* strncpy(wchar_t* strDest, const wchar_t* strSource, size_t count)
+        {
+        return std::wcsncpy(strDest, strSource, count);
+        }
+
+    ///functions not available in ANSI C
+    /*Converts an integer value into a string.
+      @param value The integer to convert.
+      @param out The character buffer to write the integer as a string into. This can be either a char* or wchar_t* buffer.
+      @param length The length of the output buffer (in character count).
+      @returns 0 on success, -1 on failure. Will fail if the buffer is either invalid
+      or not large enough to hold the converted value.*/
+    template<typename charT>
+    inline int itoa(long value, charT* out, const size_t length)
+        {
+        if (length == 0 || out == NULL)
+            { return -1; }
+        //space for a negative sign if we need it
+        const size_t signPos = value < 0 ? 1 : 0;
+        size_t i = 0;
+        if (value == 0)
+            { out[i++] = 0x30/*zero*/; }
+        else if (value < 0)
+            {
+            out[i++] = 0x2D/*minus sign*/;
+            value = -value;
+            }
+        while (value > 0 && i+1 < length)
+            {
+            out[i++] = 0x30 + value%10;
+            value /= 10;
+            }
+        /*Not enough space in the buffer or NULL terminator? Clear out the data that we copied
+        into it and return failure.*/
+        if (i+1 == length && value > 0)
+            {
+            std::memset(out,0, length*sizeof(charT));
+            return -1;
+            }
+        out[i] = 0;
+        std::reverse<charT*>(out+signPos, out+i);
+        return 0;
+        }
+    
+    /**Determines whether a character is a space, tab, or newline. Also includes double-width and no break spaces.
+    @param ch The letter to be analyzed.*/
+    template<typename T>
+    inline bool is_space(const T ch)
+        {
+        return (ch == 0x20) ?
+            true : (ch == 0x0D) ?
+            true : (ch == 0x0A) ?
+            true : (ch == 0x09) ?
+            true : (ch == 0xA0/*no break space*/) ?
+            true : (ch == 0x3000/*Japanese Ideographic Space*/) ?
+            true : (ch == 0x200B/*Zero-width space*/) ?
+            true : false;
+        }
+
+    /**Determines whether a character is a hexademical digit (0-9,A-F,a-f).
+    @param ch The letter to be analyzed.*/
+    template<typename T>
+    inline bool is_hex_digit(const T ch)
+        {
+        return (iswdigit(wchar_t(ch)) ||
+            ((ch >= 0x61/*'a'*/ && ch <= 0x66/*'f'*/) ||
+            (ch >= 0x41/*'A'*/ && ch <= 0x46/*'F'*/)) );
+        }
+
+    /**Converts string in hex format to int. Default figures out how much of the string
+    is a valid hex string, but passing a value to the second parameter overrides this
+    and allows you to indicate how much of the string to try to convert.
+    @param hexStr The string to convert.
+    @length How much of the string to analyze. The value -1 (the default) will tell the function
+    to read until there are no more valid hexadecimal digits.
+    @returns The value of the string as an integer.*/
+    template<typename T>
+    inline int axtoi(const T* hexStr, size_t length = -1)
+        {
+        if (hexStr == NULL || *hexStr == 0 || length == 0)
+            { return 0; }
+        //skip leading 0x
+        if (hexStr[0] == 0x30/*0*/ &&
+            length != 1 &&
+            is_either<T>(hexStr[1], 0x78/*x*/, 0x58/*X*/))
+            {
+            hexStr += 2;
+            //if they specified a length to read then take into account the 0x that we just skipped over
+            if (length != static_cast<size_t>(-1) && length >= 2)
+                {
+                length -= 2;
+                if (length == 0)//just a 0x string, then we're done
+                    { return 0; }
+                }
+            }
+        if (length == static_cast<size_t>(-1))
+            {
+            const T* currentPos = hexStr;
+            do
+                {
+                if (currentPos[0] == 0 || !string_util::is_hex_digit(currentPos[0]))
+                    { break; }
+                }
+            while (currentPos++);
+
+            length = currentPos-hexStr;
+            //if no valid hex digits then fail and return zero
+            if (length == 0)
+                { return 0; }
+            }
+        size_t strPos = 0;
+        int intValue = 0;
+        //storage for converted values
+        int* digits = new int[length+1]; std::auto_ptr<int> digitsDeleter(digits);
+        std::memset(digits, 0, sizeof(int)*(length+1));
+        while (strPos < length)
+            {
+            if (hexStr[strPos] == 0)
+                break;
+            //0-9
+            if (is_within<T>(hexStr[strPos], common_lang_constants::NUMBER_0, common_lang_constants::NUMBER_9) )
+                digits[strPos] = (hexStr[strPos]&0x0F);
+            //A-F
+            else if (is_within<T>(hexStr[strPos], common_lang_constants::LOWER_A, common_lang_constants::LOWER_F) ||
+                     is_within<T>(hexStr[strPos], common_lang_constants::UPPER_A, common_lang_constants::UPPER_F) )
+                digits[strPos] = (hexStr[strPos]&0x0F)+9;
+            else
+                { break; }
+            ++strPos;
+            }
+        const size_t count = strPos;
+        size_t digitPos = strPos - 1;
+        strPos = 0;
+        while (strPos < count)
+            {
+            //shift OR the bits into return value.
+            intValue = intValue | (digits[strPos] << (digitPos << 2));
+            --digitPos;
+            ++strPos;
+            }
+
+        return intValue;
+        }
+
+    /**Returns the number of characters in the string pointed to by str, not including the
+    terminating '\0' character, but at most maxlen. In doing this, strnlen looks only at
+    the first maxlen characters at str and never beyond str+maxlen. This function should be used
+    for input that may not be NULL terminated.
+       @param str The string to review.
+       @param maxlen The maximum length of the string to scan.
+       @returns the valid length of the string or maxlen, whichever is shorter.*/
+    template<typename T>
+    inline size_t strnlen(const T* str, const size_t maxlen)
+        {
+        if (!str || maxlen == 0)
+            { return 0; }
+        size_t i;
+        for (i = 0; i < maxlen && str[i]; ++i);
+        return i;
+        }
+
+    ///search for substring in string (case-insensitive)
+    template<typename T>
+    inline const T* stristr(const T* string, const T* strSearch)
+        {
+        if (!string || !strSearch || *strSearch == 0)
+            { return NULL; }
+        while (*string)
+            {
+            //compare the characters one at a time
+            size_t i = 0;
+            for (i = 0; strSearch[i] != 0; ++i)
+                {
+                if (string[i] == 0)
+                    { return NULL; }
+                if (string_util::tolower(strSearch[i]) != string_util::tolower(string[i]) )
+                    {
+                    ++string;
+                    break;
+                    }
+                }
+            //if the substring loop completed then the substring was found
+            if (strSearch[i] == 0)
+                { return string; }
+            }
+        return NULL;
+        }
+
+    /**Searches for substring in a larger string (case-insensitively), limiting the search
+    to a specified number of characters.*/
+    template<typename T>
+    inline const T* strnistr(const T* string, const T* strSearch, const size_t string_len)
+        {
+        if (!string || !strSearch || string_len == 0 || *strSearch == 0)
+            { return NULL; }
+        for (size_t i = 0; i < string_len; ++i)
+            {
+            //compare the characters one at a time
+            size_t j = 0;
+            for (j = 0; strSearch[j] != 0; ++j)
+                {
+                if ((i+j) >= string_len || string[i+j] == 0)
+                    { return NULL; }
+                if (string_util::tolower(strSearch[j]) != string_util::tolower(string[i+j]) )
+                    { break; }
+                }
+            //if the substring loop completed then the substring was found
+            if (strSearch[j] == 0)
+                { return (string+i); }
+            }
+        return NULL;
+        }
+
+    /**Search string in reverse for substring.
+    "offset" is how far we are in the source string already and how far
+    to go back.*/
+    template<typename T>
+    inline const T* strrstr(const T* string,
+                    const T* search,
+                    size_t offset)
+        {
+        if (!string || !search)
+            { return NULL; }
+        const size_t len = string_util::strlen(search);
+        if (len > offset) return NULL;
+        string -= len;
+        offset -= len;
+        bool fnd = false;
+        while (!fnd && offset > 0)
+            {
+            fnd = true;
+            for (size_t i=0; i < len; ++i)
+                {
+                if (string[i] != search[i])
+                    {
+                    fnd = false;
+                    break;
+                    }
+                }
+            if (fnd) return string;
+            --string;
+            --offset;
+            }
+        return NULL;
+        }
+
+    ///Case-insensitive comparison by character count.
+    template<typename T>
+    inline int strnicmp(const T* first, const T* last, size_t count)
+        {
+        //first check if either of the strings are NULL
+        if (!first && !last)
+            { return 0; }
+        else if (!first && last)
+            { return -1; }
+        else if (first && !last)
+            { return 1; }
+
+        int f,l;
+        int result = 0;
+
+        if (count)
+            {
+            do
+                {
+                f = string_util::tolower(*(first++) );
+                l = string_util::tolower(*(last++) );
+                } while ( (--count) && f && (f == l) );
+            result = static_cast<int>(f - l);
+            }
+        return result;
+        }
+
+    ///Case-insensitive comparison.
+    template<typename T>
+    inline int stricmp(const T* first, const T* last)
+        {
+        //first check if either of the strings are NULL
+        if (!first && !last)
+            { return 0; }
+        else if (!first && last)
+            { return -1; }
+        else if (first && !last)
+            { return 1; }
+
+        int f,l;
+        do
+            {
+            f = string_util::tolower(*(first++) );
+            l = string_util::tolower(*(last++) );
+            } while (f && (f == l) );
+
+        return static_cast<int>(f - l);
+        }
+
+    /**Natural order comparison functions.
+    Compare, recognizing numeric strings.*/
+    template<typename T>
+    inline int strnatordcmp(const T* first_string, const T* second_string, bool case_insensitive = false)
+        {
+        //first check if either of the strings are NULL
+        if (!first_string && !second_string)
+            { return 0; }
+        else if (!first_string && second_string)
+            { return -1; }
+        else if (first_string && !second_string)
+            { return 1; }
+
+        size_t first_string_index = 0, second_string_index = 0;
+        T ch1, ch2;
+        while (true)
+            {
+            ch1 = first_string[first_string_index];
+            ch2 = second_string[second_string_index];
+
+            //skip leading spaces
+            while (is_space(ch1))
+                { ch1 = first_string[++first_string_index]; }
+
+            while (is_space(ch2))
+                { ch2 = second_string[++second_string_index]; }
+
+            //process run of digits
+            if (iswdigit(ch1) && iswdigit(ch2))
+                {
+                T *firstEnd, *secondEnd;
+                double firstDouble = string_util::strtod(first_string+first_string_index, &firstEnd);
+                double secondDouble = string_util::strtod(second_string+second_string_index, &secondEnd);
+
+                if (firstDouble < secondDouble)
+                    { return -1; }
+                else if (firstDouble > secondDouble)
+                    { return 1; }
+                else //numbers are equal
+                    {
+                    //if this was the end of both strings then they are equal
+                    if (*firstEnd == 0 && *secondEnd == 0)
+                        { return 0; }
+                    /*the first string is done, but there is more to the second string
+                    after the number, so first is smaller*/
+                    else if (*firstEnd == 0)
+                        { return -1; }
+                    /*the second string is done, but there is more to the first string
+                    after the number, so first is bigger*/
+                    else if (*secondEnd == 0)
+                        { return 1; }
+                    //there is more to both of them, so move the counter and move on
+                    else
+                        {
+                        first_string_index = (firstEnd - first_string);
+                        second_string_index = (secondEnd - second_string);
+                        continue;
+                        }
+                    }
+                }
+
+            //if we are at the end of the strings then they are the same
+            if (ch1 == 0 && ch2 == 0)
+                { return 0; }
+
+            if (case_insensitive)
+                {
+                ch1 = string_util::tolower(ch1);
+                ch2 = string_util::tolower(ch2);
+                }
+
+            if (ch1 < ch2)
+                { return -1; }
+            else if (ch1 > ch2)
+                { return 1; }
+
+            ++first_string_index;
+            ++second_string_index;
+            }
+        }
+
+    ///Compare, recognizing numeric strings and ignoring case.
+    template<typename T>
+    inline int strnatordncasecmp(const T* a, const T* b)
+        {
+        return strnatordcmp(a, b, true);
+        }
+
+    ///Indicates whether a larger strings ends with the specified suffix. Lengths are provided
+    ///by the caller for efficiency. This function is case sensitive.
+    template<typename T>
+    inline bool has_suffix(const T* text, const size_t text_length, const T* suffix, const size_t suffix_length)
+        {
+        if (text == NULL || suffix == NULL || text_length <= suffix_length)
+            { return false; }
+        return (string_util::strnicmp(text+(text_length-suffix_length), suffix, suffix_length) == 0);
+        }
+
+    /**Searches for a matching tag, skipping an extra open/close pairs of symbols in between.
+    @param openSymbol The opening symbol.
+    @param closeSymbol The closing symbol that we are looking for.
+    @param fail_on_overlapping_open_symbol Whether it should immediately return failure if an open
+    symbol is found before a matching close symbol.
+    @returns a pointer to where the closing tag is, or NULL if one can't be found.*/
+    template<typename T>
+    inline const T* find_matching_close_tag(const T* string, const T openSymbol, const T closeSymbol,
+                                            const bool fail_on_overlapping_open_symbol = false)
+        {
+        if (!string)
+            { return NULL; }
+        long open_stack = 0;
+        while (*string)
+            {
+            if (string[0] == openSymbol)
+                {
+                if (fail_on_overlapping_open_symbol)
+                    { return NULL; }
+                ++open_stack;
+                }
+            else if (string[0] == closeSymbol)
+                {
+                if (open_stack == 0)
+                    { return string; }
+                --open_stack;
+                }
+            ++string;
+            }
+        return NULL;
+        }
+
+    ///Searches for a matching tag, skipping an extra open/close pairs of symbols in between.
+    template<typename T>
+    inline const T* find_matching_close_tag(const T* string, const T* openSymbol,
+                                            const T* closeSymbol)
+        {
+        if (!string || !openSymbol || !closeSymbol)
+            { return NULL; }
+        const size_t openSymbolLength = string_util::strlen(openSymbol);
+        const size_t closeSymbolLength = string_util::strlen(closeSymbol);
+        if (openSymbolLength == 0 || closeSymbolLength == 0)
+            { return NULL; }
+        long open_stack = 0;
+        const T openSymbolFirstCharacter = openSymbol[0];
+        const T closeSymbolFirstCharacter = closeSymbol[0];
+        while (*string)
+            {
+            //to prevent unnecessary calls to strncmp, we check the current character first
+            if (string[0] == openSymbolFirstCharacter &&
+                     string_util::strncmp(string,openSymbol,openSymbolLength) == 0)
+                {
+                ++open_stack;
+                string += openSymbolLength;
+                continue;
+                }
+            else if (string[0] == closeSymbolFirstCharacter &&
+                     string_util::strncmp(string,closeSymbol,closeSymbolLength) == 0)
+                {
+                if (open_stack == 0)
+                    { return string; }
+                --open_stack;
+                }
+            ++string;
+            }
+        return NULL;
+        }
+
+    /**Search for a single character in a string for n number of characters.
+    Size argument should be less than or equal to the length of the string being searched.
+    @param string The string to search in.
+    @param ch The character to search for.
+    @param size The size of the search string.
+    @returns A pointer in the string where the character was found, or NULL if not found.*/
+    template<typename T>
+    inline const T* strnchr(const T* string, const T ch, size_t size)
+        {
+        if (!string)
+            { return NULL; }
+        size_t i = 0;
+        for (i = 0; i < size; ++i)
+            {
+            /*if string being searched is shorter
+            than the size argument then return failure (NULL).*/
+            if (string[i] == 0)
+                {
+                NON_UNIT_TEST_ASSERT(0 && "strnchr: string shorter than size parameter.");
+                return NULL;
+                }
+            if (string[i] == ch)
+                { return string+i; }
+            }
+        return NULL;
+        }
+
+    /**search for a single character from a sequence in a string and
+    return a pointer if found.*/
+    template<typename T>
+    inline const T* strcspn_pointer(const T* string1, const T* string2, const size_t string2Length)
+        {
+        if (!string1 || !string2)
+            { return NULL; }
+        size_t i = 0;
+        while (string1)
+            {
+            if (string1[0] == 0)
+                { return NULL; }
+            for (i = 0; i < string2Length; ++i)
+                {
+                if (string1[0] == string2[i])
+                    { return string1; }
+                }
+            ++string1;
+            }
+        return NULL;
+        }
+
+    /**Search for a single character from a sequence in a string for n number of characters.
+    @param stringToSearch The string to search.
+    @param stringToSearchLength The length of the string being searched.
+    @param searchString The sequence of characters to search for.
+    @param searchStringLength The length of the sequence string.
+    @returns The index into the string that the character was found. Returns the length of the string if not found.*/
+    template<typename T>
+    inline size_t strncspn(const T* stringToSearch, const size_t stringToSearchLength,
+        const T* searchString, const size_t searchStringLength)
+        {
+        if (!stringToSearch || !searchString || stringToSearchLength == 0 || searchStringLength == 0)
+            { return stringToSearchLength; }
+        size_t i = 0, j = 0;
+        for (i = 0; i < stringToSearchLength; ++i)
+            {
+            /*If string being searched is shorter than the size argument then fail.
+            Note that we should pass back the length of the string that the caller passed in
+            so that they know that it failed, not the actual position that we stopped on which would
+            be a NULL termintor.*/
+            if (stringToSearch[i] == 0)
+                {
+                NON_UNIT_TEST_ASSERT(0 && "strncspn: string shorter than size parameter.");
+                return stringToSearchLength;
+                }
+            for (j = 0; j < searchStringLength; ++j)
+                {
+                if (stringToSearch[i] == searchString[j])
+                    { return i; }
+                }
+            }
+        return i;
+        }
+
+    /**search for a single character not from a sequence in a string in reverse.
+    @param string The string to search in.
+    @param search The sequence of characters to skip.
+    @param offset Where to begin the search. If -1, then the reverse search will begin at the end of the string.
+    @returns the position of where the last non-matching character is at, or -1 if it can't be found.*/
+    template<typename T>
+    inline size_t find_last_not_of(const T* string, const T* search,
+                    size_t offset = std::basic_string<T>::npos)
+        {
+        if (!string || !search)
+            { return std::basic_string<T>::npos; }
+        if (offset == std::basic_string<T>::npos)
+            { offset = string_util::strlen(string)-1; }
+
+        size_t i=0;
+        while (offset != std::basic_string<T>::npos)
+            {
+            for (i = 0; search[i] != 0; ++i)
+                {
+                if (string[offset] == search[i])
+                    { break; }
+                }
+            //If the whole search string wasn't scanned, then there was a match. Move on.
+            if (search[i] != 0)
+                {
+                if (offset == 0)
+                    { return std::basic_string<T>::npos; }
+                --offset;
+                }
+            else
+                { return offset; }
+            }
+        return std::basic_string<T>::npos;
+        }
+
+    /**search for the last instance of a character in a string in reverse.
+    @param string The string to search.
+    @param ch The character to search for.
+    @param offset The offset in the string to begin the search from. The default (-1) will begin the search at the end of the string.
+    @returns The offset of the found character, or -1 if not found.*/
+    template<typename T>
+    inline size_t find_last_of(const T* string,
+                    const T ch,
+                    size_t offset = -1)
+        {
+        if (!string)
+            { return static_cast<size_t>(-1); }
+        if (offset == static_cast<size_t>(-1))
+            { offset = string_util::strlen(string)-1; }
+
+        while (offset != static_cast<size_t>(-1))
+            {
+            if (string[offset] == ch)
+                { return offset; }
+            --offset;
+            }
+        return static_cast<size_t>(-1);
+        }
+
+    /*search for the first occurrence that is not a character from a sequence in
+    a string for n number of characters and returns zero-based index if found.
+    @param stringToSearch The string to search.
+    @param stringToSearchLength The length of the string being searched.
+    @param searchString The sequence of characters to perform a reverse match with.
+    @param searchStringLength The length of the character sequence.
+    @returns The index into the string that the character was not found, or 
+    the length of the string if nothing was found that couldn't match the search string.*/
+    template<typename T>
+    inline size_t find_first_not_of(const T* stringToSearch, const size_t stringToSearchLength,
+                                    const T* searchString, const size_t searchStringLength)
+        {
+        if (!stringToSearch || !searchString || stringToSearchLength == 0 || searchStringLength == 0)
+            { return stringToSearchLength; }
+        size_t i = 0, j = 0;
+        for (i = 0; i < stringToSearchLength; ++i)
+            {
+            /*If string being searched is shorter
+            than the size argument then return string length to indicate failure to find anything.
+            Although this isn't really the index that we stopped in, this will tell the caller that
+            the search failed.*/
+            if (stringToSearch[i] == 0)
+                {
+                NON_UNIT_TEST_ASSERT(0 && "find_first_not_of: string shorter than size parameter.");
+                return stringToSearchLength;
+                }
+            for (j = 0; j < searchStringLength; ++j)
+                {
+                //stop if a character matching anything in the sequence
+                if (stringToSearch[i] == searchString[j])
+                    { break; }
+                }
+            //if we went through the whole sequence then nothing matched
+            if (j == searchStringLength)
+                { return i; }
+            }
+        return i;
+        }
+
+    //utility classes
+    //equal functors
+    template<typename T>
+    class equal_string_i_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::stricmp(a_, b_) == 0);
+            }
+        };
+
+    template<typename T>
+    class equal_basic_string_i_compare
+        : public std::binary_function<T, T, bool>
+        {
+    public:
+        inline bool operator()(const T& a_, const T& b_) const
+            {
+            return (string_util::stricmp(a_.c_str(), b_.c_str()) == 0);
+            }
+        };
+
+    template<typename T>
+    class equal_string_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::strcmp(a_, b_) == 0);
+            }
+        };
+
+    //less functors
+    template<typename T>
+    class less_string_n_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        less_string_n_compare(size_t comparison_size) : m_comparison_size(comparison_size) {}
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::strncmp(a_, b_, m_comparison_size) < 0);
+            }
+    private:
+        size_t m_comparison_size;
+        };
+
+    template<typename T>
+    class less_string_ni_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        less_string_ni_compare(size_t comparison_size) : m_comparison_size(comparison_size) {}
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::strnicmp(a_, b_, m_comparison_size) < 0);
+            }
+    private:
+        size_t m_comparison_size;
+        };
+
+    template<typename T>
+    class less_string_i_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::stricmp(a_, b_) < 0);
+            }
+        };
+
+    template<typename T>
+    class less_string_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::strcmp(a_, b_) < 0);
+            }
+        };
+
+    template<typename T>
+    class less_basic_string_compare
+        : public std::binary_function<T, T, bool>
+        {
+    public:
+        inline bool operator()(const T& a_, const T& b_) const
+            {
+            return (string_util::strcmp(a_.c_str(), b_.c_str()) < 0);
+            }
+        };
+
+    template<typename T>
+    class less_string_natural_order_i_compare
+        : public std::binary_function<const T*, const T*, bool>
+        {
+    public:
+        inline bool operator()(const T* a_, const T* b_) const
+            {
+            return (string_util::strnatordncasecmp(a_, b_) < 0);
+            }
+        };
+
+    ///trims whitespace from around a string
+    template<typename char_typeT>
+    class string_trim
+        {
+    public:
+        const char_typeT* operator()(const char_typeT* value,
+                                     size_t length = std::basic_string<char_typeT>::npos)
+            {
+            m_trimmed_string_length = 0;
+            if (value == NULL)
+                { return NULL; }
+            if (length == 0)
+                { return value; }
+            if (length == std::basic_string<char_typeT>::npos)
+                { length = string_util::strlen(value); }
+            const char_typeT* start = value;
+            //end is last valid character in the string, not the one after it
+            const char_typeT* end = value+(length-1);
+            while (start && (start <= end))
+                {
+                if (is_space(start[0]))
+                    { ++start; }
+                else
+                    { break; }
+                }
+            while (end > start)
+                {
+                if (is_space(end[0]))
+                    { --end; }
+                else
+                    { break; }
+                }
+            //if start overran end then this string was all spaces.
+            m_trimmed_string_length = (start > end) ? 0 : (end-start)+1;
+            return start;
+            }
+        size_t get_trimmed_string_length() const
+            { return m_trimmed_string_length; }
+    private:
+        size_t m_trimmed_string_length;
+        };
+
+    /** \addtogroup StringOperations
+    * Classes for string operations.
+    * @{*/
+    /**
+    \class string_tokenize
+        Tokenizes a string using a set of delimiters.
+    \date 2010
+    */
+    /** @} */
+    template<typename T>
+    class string_tokenize
+        {
+    public:
+        ///Constructor which takes the string to parse and the delimiters to use.
+        ///@param val The string to parse.
+        ///@param delim The set of delimiters to separate the string.
+        string_tokenize(const T& val, const T& delim) :
+            m_value(val), m_start(NULL), m_next_delim(NULL), m_delim(delim), m_has_more_tokens(true)
+            {
+            m_start = m_value.c_str();
+            m_next_delim = string_util::strcspn_pointer(m_start, m_delim.c_str(), m_delim.length());
+            }
+        ///Returns whether or not there are more tokens in the string.
+        inline bool has_more_tokens() const
+            { return m_has_more_tokens; }
+        ///Returns whether or not there are more delimiters in the string.
+        ///This is useful for seeing if there are any delimiters at all when first loading the string.
+        inline bool has_more_delimiters() const
+            { return (m_next_delim != NULL); }
+        ///Returns the next token from the original string as a string object
+        ///Note that empty tokens can be returned if there is proceeding or trailing
+        ///delimiters in the string, or if there are repeated delimiters next to each other.
+        inline T get_next_token()
+            {
+            if (m_next_delim)
+                {
+                const wchar_t* current_start = m_start;
+                const wchar_t* current_next_delim = m_next_delim;
+                //move the pointers to the next token
+                m_start = ++m_next_delim;
+                m_next_delim = string_util::strcspn_pointer(m_start, m_delim.c_str(), m_delim.length());
+                return T(current_start, current_next_delim-current_start);
+                }
+            //no more delims means that we are on the last token
+            else if (m_start)
+                {
+                m_has_more_tokens = false;
+                const wchar_t* current_start = m_start;
+                m_start = NULL;
+                return T(current_start);
+                }
+            //if called when there are no more tokens, then return an empty string
+            else
+                {
+                m_has_more_tokens = false;
+                return T();
+                }
+            }
+    private:
+        string_tokenize() {}
+        string_tokenize(const string_tokenize&) {}
+
+        T m_value;
+        const wchar_t* m_start;
+        const wchar_t* m_next_delim;
+        T m_delim;
+        bool m_has_more_tokens;
+        };
+
+    ///Removes all whitespace from a string
+    template<typename T>
+    inline T remove_all_whitespace(const T& text)
+        {
+        T tempText = text;
+        for (typename T::size_type i = 0; i < tempText.length(); /*in loop*/)
+            {
+            if (tempText[i] == 10 || tempText[i] == 13 || tempText[i] == 9)
+                { tempText.erase(i,1); }
+            else
+                { ++i; }
+            }
+        return tempText;
+        }
+
+    ///Removes all instances of a character from a string.
+    template<typename Tchar_type, typename T>
+    inline void remove_all(T& text, Tchar_type char_to_replace)
+        {
+        size_t start = 0;
+        while (start != T::npos)
+            {
+            start = text.find(char_to_replace, start);
+            if (start == T::npos)
+                { return; }
+            text.erase(start,1);
+            }
+        }
+
+    ///helper functions for stemmers
+    template<typename Tchar_type, typename T>
+    inline void replace_all(T& text, Tchar_type text_to_replace, Tchar_type replacement_text)
+        {
+        size_t start = 0;
+        while (start != T::npos)
+            {
+            start = text.find(text_to_replace, start);
+            if (start == T::npos)
+                {
+                return;
+                }
+            text[start++] = replacement_text;
+            }
+        }
+
+    template<typename T, typename Tchar_type>
+    inline void replace_all(T& text, const Tchar_type* text_to_replace, const Tchar_type* replacement_text)
+        {
+        size_t start = 0;
+        const size_t textToReplaceLength = string_util::strlen(text_to_replace);
+        while (start != T::npos)
+            {
+            start = text.find(text_to_replace, start);
+            if (start == T::npos)
+                {
+                return;
+                }
+            text.replace(start, textToReplaceLength, replacement_text);
+            }
+        }
+
+    template<typename T>
+    inline void replace_all(T& text, const T& text_to_replace, const T& replacement_text)
+        {
+        size_t start = 0;
+        while (start != T::npos)
+            {
+            start = text.find(text_to_replace, start);
+            if (start == T::npos)
+                {
+                return;
+                }
+            text.replace(start, text_to_replace.length(), replacement_text);
+            }
+        }
+
+    /**strips extraneous spaces/tabs/carriage returns from a block of text so
+    that there isn't more than one space consecutively.*/
+    template<typename string_typeT>
+    size_t remove_extra_spaces(string_typeT& Text)
+        {
+        size_t numberOfSpacesRemoved = 0;
+
+        if (!Text.length() )
+            { return 0; }
+        bool alreadyHasSpace = true;
+        //make sure that there is only a space between each word
+        for (unsigned int i = 0; i < Text.length(); ++i)
+            {
+            //if this is the first space found after the current
+            //word then it's OK--just leave it
+            if (is_space(static_cast<wchar_t>(Text[i])) && !alreadyHasSpace)
+                { alreadyHasSpace = true; }
+            //this is extra space right after another--get rid of it
+            else if (is_space(static_cast<wchar_t>(Text[i])) && alreadyHasSpace)
+                {
+                //make sure it isn't a Windows \r\n
+                if (i && !(Text[i-1] == 13 && Text[i] == 10))
+                    {
+                    ++numberOfSpacesRemoved;
+                    Text.erase(i--,1);
+                    }
+                }
+            //we are starting another word--reset
+            else if (!is_space(static_cast<wchar_t>(Text[i])))
+                { alreadyHasSpace = false; }
+            }
+
+        return numberOfSpacesRemoved;
+        }
+
+    /**Removes blank lines from a block of text
+    @param Text The text to have blank lines removed from.
+    @return Number of characters (not lines) removed from the block.*/
+    template<typename string_typeT>
+    size_t remove_blank_lines(string_typeT& Text)
+        {
+        size_t numberOfLinesRemoved = 0;
+
+        if (!Text.length() )
+            { return 0; }
+        bool alreadyHasNewLine = true;
+        //make sure that there is only a space between each word
+        for (unsigned int i = 0; i < Text.length(); ++i)
+            {
+            //if this is the first space found after the current
+            //word then it's OK--just leave it
+            if (is_either<wchar_t>(static_cast<wchar_t>(Text[i]), 10, 13) && !alreadyHasNewLine)
+                { alreadyHasNewLine = true; }
+            //this is extra space right after another--get rid of it
+            else if (is_either<wchar_t>(static_cast<wchar_t>(Text[i]), 10, 13) && alreadyHasNewLine)
+                {
+                //make sure it isn't a Windows \r\n
+                if (i && !(Text[i-1] == 13 && Text[i] == 10))
+                    {
+                    ++numberOfLinesRemoved;
+                    Text.erase(i--,1);
+                    }
+                }
+            //we are starting another word--reset
+            else if (!is_either<wchar_t>(static_cast<wchar_t>(Text[i]), 10, 13))
+                { alreadyHasNewLine = false; }
+            }
+
+        return numberOfLinesRemoved;
+        }
+
+    /**Converts strings to double values, but also takes into account ranges (returning the average). For example, a string
+    like "5-8" will return 6.5. Hyphens and colons are seen as range separators.*/
+    template<typename Tchar_type>
+    inline double strtod_ex(const Tchar_type* nptr, Tchar_type** endptr)
+        {
+        if (nptr == NULL)
+            {
+            *endptr = NULL;
+            return 0.0f;
+            }
+        wchar_t sepStr[3] = { 0x2D, 0x3A, 0 };
+        const Tchar_type* separator = string_util::strcspn_pointer<Tchar_type>(nptr, sepStr, 2);
+        //if there is no hyphen or there is one but it is at the end then just call strtod
+        if (separator == NULL || *(separator+1) == 0)
+            { return string_util::strtod(nptr, endptr); }
+        else
+            {
+            const double d1 = string_util::strtod(nptr, endptr);
+            const double d2 = string_util::strtod(++separator, endptr);
+            return safe_divide<double>(d1+d2, 2);
+            }
+        }
+
+    template<typename Tchar_type>
+    inline bool is_one_of(const Tchar_type character, const Tchar_type* char_string)
+        {
+        while(*char_string)
+            {
+            if (character == char_string[0])
+                {
+                return true;
+                }
+            ++char_string;
+            }
+        return false;
+        }
+    }
+
+#endif //__STRING_UTIL_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/danish_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/danish_stem.h
new file mode 100644 (file)
index 0000000..ceeb0bc
--- /dev/null
@@ -0,0 +1,338 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __DANISH_STEM_H__
+#define __DANISH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class danish_stem
+        Danish stemming class.
+
+    The Danish alphabet includes the following additional letters:
+        - æ å ø
+
+    The following letters are vowels:
+        - a e i o u y æ å ø
+
+    A consonant is defined as a non-vowel.
+
+    R2 is not used: R1 is defined in the same way as in the German stemmer.
+
+    Define a valid s-ending as one of 
+        - a b c d f g h j k l m n o p r t v y z å
+
+    \par Example:
+    \code
+    std::wstring word(L"ramningen");
+    stemming::danish_stem<myString> StemDanish;
+    StemDanish(word);
+    \endcode
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated: 
+            - hed ethed ered e erede ende erende ene erne ere en heden
+               eren er heder erer heds es endes erendes enes ernes eres
+               ens hedens erens ers ets erets et eret.
+               - Delete.
+            - s
+               - Delete, if preceded by a valid s-ending.
+
+    (Of course the letter of the valid s-ending is not necessarily in R1).
+
+    <b>Step 2:</b>
+
+    Search for one of the following suffixes in R1, and if found delete the last letter.:
+            - gd dt gt kt
+
+    (For example, friskt -> frisk).
+
+    <b>Step 3:</b>
+
+    If the word ends with igst, remove the final st. Search for the longest among the following suffixes in R1, and perform the action indicated:
+            - ig lig elig els
+                - Delete, and then repeat step 2.
+            - løst
+                - Replace with løs.
+
+    <b>Step 4 (undouble):</b>
+
+    If the word ends with double consonant in R1, then remove one of the consonants. 
+
+    (For example, bestemmelse -> bestemmels (step 1) -> bestemm (step 3a) -> bestem in this step).
+    */
+    /** @} */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class danish_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param[in,out] text Danish string to stem.*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                return;
+                }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //see where the R1 section begins
+            //R1 is the first consonant after the first vowel
+            stem<string_typeT>::find_r1(text, DANISH_VOWELS);
+            if (stem<string_typeT>::get_r1() == text.length() )
+                {
+                return;
+                }
+            //R1 must have at least 3 characters in front of it
+            if (stem<string_typeT>::get_r1() < 3)
+                {
+                stem<string_typeT>::set_r1(3);
+                }
+            //danish does not use R2
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+            step_4(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*erendes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erende*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*hedens*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ethed*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erede*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heden*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heder*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*endes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ernes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erens*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erets*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*eres*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*enes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heds*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erer*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*eren*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erne*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ende*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ered*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*eret*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*hed*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ets*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ere*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ene*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ens*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ers*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*et*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 2 &&
+                    string_util::is_one_of(text[text.length()-2], DANISH_ALPHABET) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*gd*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*dt*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*gt*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*kt*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text)
+            {
+            //do this check separately
+            if (stem<string_typeT>::is_suffix(text,/*igst*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            //now start looking for the longest suffix
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*elig*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                step_2(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*løst*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O_STROKE, common_lang_constants::UPPER_O_STROKE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*lig*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                step_2(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*els*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                step_2(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                step_2(text);
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_4(string_typeT& text)
+            {
+            //undouble consecutive (same) consonants if either are in R1 section
+            if (text.length() >= 2 &&
+                stem<string_typeT>::get_r1() <= text.length()-1 &&
+                string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]) )
+                {
+                if (!string_util::is_one_of(text[text.length()-2], DANISH_VOWELS) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        };
+    }
+
+#endif //__DANISH_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/dutch_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/dutch_stem.h
new file mode 100644 (file)
index 0000000..ebd7781
--- /dev/null
@@ -0,0 +1,317 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __DUTCH_STEM_H__
+#define __DUTCH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    Language-specific stemming classes.
+    * @{*/
+    /**
+    \class dutch_stem
+    Dutch includes the following accented forms:
+    - ä ë ï ö ü á é í ó ú è
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated: 
+            - heden 
+                - Replace with heid if in R1.
+            - en ene 
+                - Delete if in R1 and preceded by a valid en-ending, and then undouble the ending.
+            - s se 
+                - Delete if in R1 and preceded by a valid s-ending.
+
+    <b>Step 2:</b>
+
+    Delete suffix e if in R1 and preceded by a non-vowel, and then undouble the ending.
+
+    <b>Step 3a (heid):</b>
+
+    Delete heid if in R2 and not preceded by c, and treat a preceding en as in step 1(b).
+
+    <b>Step 3b (d-suffixes [*]):</b>
+    
+    Search for the longest among the following suffixes, and perform the action indicated. 
+            - end ing
+                - Delete if in R2.
+                - If preceded by ig, delete if in R2 and not preceded by e, otherwise undouble the ending.
+            - ig
+                - Delete if in R2 and not preceded by e.
+            - lijk
+                - Delete if in R2, and then repeat step 2.
+            - baar
+                - Delete if in R2.
+            - bar
+                - Delete if in R2 and if step 2 actually removed an e.
+
+    <b>Step 4 (undouble vowel):</b>
+    
+    If the words ends CVD, where C is a non-vowel, D is a non-vowel other than I,
+    and V is double a, e, o, or u, then remove one of the vowels from V.
+    
+    (for example, maan -> man, brood -> brod).
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class dutch_stem : public stem<string_typeT>
+        {
+    public:
+        dutch_stem() : m_step_2_succeeded(false) {}
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            //First, remove all umlaut and acute accents
+            stem<string_typeT>::remove_dutch_umlauts(text);
+            stem<string_typeT>::remove_dutch_acutes(text);
+
+            if (text.length() < 3)
+                {
+                return;
+                }
+
+            //reset internal data
+            m_step_2_succeeded = false;
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //Hash initial y, y after a vowel, and i between vowels
+            stem<string_typeT>::hash_dutch_yi(text, DUTCH_VOWELS);
+
+            stem<string_typeT>::find_r1(text, DUTCH_VOWELS);
+            stem<string_typeT>::find_r2(text, DUTCH_VOWELS);
+            //R1 must have at least 3 characters in front of it
+            if (stem<string_typeT>::get_r1() < 3)
+                { stem<string_typeT>::set_r1(3); }
+
+            step_1(text);
+            step_2(text);
+            step_3a(text);
+            step_3b(text);
+            step_4(text);
+
+            //unhash I and Y back into their original form 
+            stem<string_typeT>::unhash_dutch_yi(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*heden*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    text[text.length()-2] = common_lang_constants::LOWER_I;
+                    text[text.length()-1] = common_lang_constants::LOWER_D;
+                    }
+                }
+            ///Define a valid en-ending as a non-vowel, and not gem.
+            else if (stem<string_typeT>::is_suffix(text,/*ene*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E)    )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-3 &&
+                    !string_util::is_one_of(text[text.length()-4], DUTCH_VOWELS) &&
+                    (text.length() < 6 ||
+                    //"gem" in front of "en" ending
+                    !(is_either<wchar_t>(text[text.length()-6], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ) ) )
+                    {
+                    text.erase(text.length()-3);
+                    //undouble dd, kk, tt
+                    if (string_util::is_one_of(text[text.length()-1], DUTCH_KDT) &&
+                        string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]))
+                        { text.erase(text.length()-1); }
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-2 &&
+                    !string_util::is_one_of(text[text.length()-3], DUTCH_VOWELS) &&
+                    (text.length() < 5 ||
+                    !(is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ) ) )
+                    {
+                    text.erase(text.length()-2);
+                    //undouble dd, kk, tt
+                    if (string_util::is_one_of(text[text.length()-1], DUTCH_KDT) &&
+                        string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]) )
+                        { text.erase(text.length()-1); }
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (text.length() >= 3 &&
+                stem<string_typeT>::is_suffix(text,/*se*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                !string_util::is_one_of(text[text.length()-3], DUTCH_S_ENDING))
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            ///Define a valid s-ending as a non-vowel other than j
+            else if (text.length() >= 2 &&
+                stem<string_typeT>::is_suffix(text, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                !string_util::is_one_of(text[text.length()-2], DUTCH_S_ENDING))
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-1)
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            }
+
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (text.length() >= 2 &&
+                    stem<string_typeT>::get_r1() <= text.length()-1 &&
+                    !string_util::is_one_of(text[text.length()-2], DUTCH_VOWELS) )
+                    {
+                    //watch out for vowel I/Y vowel
+                    if (text.length() >= 3 &&
+                        string_util::is_one_of(text[text.length()-2], L"iyIY") &&
+                        string_util::is_one_of(text[text.length()-3], DUTCH_VOWELS) )
+                        { return; }
+                    else
+                        {
+                        text.erase(text.length()-1);
+                        //undouble dd, kk, tt
+                        if (string_util::is_one_of(text[text.length()-1], DUTCH_KDT) &&
+                            string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]))
+                            { text.erase(text.length()-1); }
+                        stem<string_typeT>::update_r_sections(text);
+                        m_step_2_succeeded = true;
+                        }
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_3a(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*heid*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_r2() <= text.length()-4 &&
+                    is_neither<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    if (stem<string_typeT>::get_r1() <= text.length()-2 &&
+                        stem<string_typeT>::is_suffix(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                        {
+                        if ((!string_util::is_one_of(text[text.length()-3], DUTCH_VOWELS) ||
+                            (string_util::is_one_of(text[text.length()-3], L"iyYI") &&
+                            string_util::is_one_of(text[text.length()-4], DUTCH_VOWELS))) &&
+                            (text.length() < 5 ||
+                            !(is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                            is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                            is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ) ) )
+                            {
+                            text.erase(text.length()-2);
+                            //undouble dd, kk, tt
+                            if (string_util::is_one_of(text[text.length()-1], DUTCH_KDT) &&
+                                string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]))
+                                { text.erase(text.length()-1); }
+                            stem<string_typeT>::update_r_sections(text);
+                            }
+                        }
+                    return;
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_3b(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r2(text,/*end*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ing*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                stem<string_typeT>::update_r_sections(text);
+                if (text.length() > 3)
+                    {
+                    if (is_neither<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E , common_lang_constants::UPPER_E) &&
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                        {
+                        stem<string_typeT>::update_r_sections(text);
+                        return;
+                        }
+                    else
+                        {
+                        if (string_util::is_one_of(text[text.length()-1], DUTCH_KDT) &&
+                            string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-1]))
+                            {
+                            text.erase(text.length()-1);
+                            stem<string_typeT>::update_r_sections(text);
+                            return;
+                            }
+                        }
+                    }
+                return;
+                }
+            else if (!(text.length() >= 3 && is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ) &&
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*baar*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*lijk*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J, common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) )
+                {
+                step_2(text);
+                return;
+                }
+            else if (m_step_2_succeeded &&
+                stem<string_typeT>::delete_if_is_in_r2(text,/*bar*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                return;
+                }
+            }
+        //------------------------------------------------------
+        void step_4(string_typeT& text)
+            {
+            //undouble consecutive (same) consonants
+            if (text.length() >= 4 &&
+                !string_util::is_one_of(text[text.length()-4], DUTCH_VOWELS) &&
+                !string_util::is_one_of(text[text.length()-1], DUTCH_VOWELS) &&
+                text[text.length()-1] != LOWER_I_HASH &&
+                text[text.length()-1] != UPPER_I_HASH &&
+                string_util::is_one_of(text[text.length()-2], L"aeouAEOU") &&
+                string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-3]) )
+                {
+                text.erase(text.end()-2, text.end()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //internal data specific to Dutch stemmer
+        bool m_step_2_succeeded;
+        };
+    }
+
+#endif //__DUTCH_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/english_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/english_stem.h
new file mode 100644 (file)
index 0000000..ace665a
--- /dev/null
@@ -0,0 +1,1003 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __ENGLISH_STEM_H__
+#define __ENGLISH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+        Language-specific stemming classes.
+    * @{*/
+    /**
+    \class english_stem
+
+    Overview
+
+    I have made more than one attempt to improve the structure of the Porter algorithm 
+    by making it follow the pattern of ending removal of the Romance language stemmers.
+    It is not hard to see why one should want to do this: step 1b of the Porter stemmer 
+    removes ed and ing, which are i-suffixes (*) attached to verbs. If these suffixes are
+    removed, there should be no need to remove d-suffixes which are not verbal, although it
+    will try to do so. This seems to be a deficiency in the Porter stemmer, not shared by
+    the Romance stemmers. Again, the divisions between steps 2, 3 and 4 seem rather arbitrary,
+    and are not found in the Romance stemmers.
+
+    Nevertheless, these attempts at improvement have been abandoned. They seem to lead to a
+    more complicated algorithm with no very obvious improvements. A reason for not taking
+    note of the outcome of step 1b may be that English endings do not determine word categories
+    quite as strongly as endings in the Romance languages. For example, condition and position
+    in French have to be nouns, but in English they can be verbs as well as nouns,
+
+    We are all conditioned by advertising
+    They are positioning themselves differently today
+
+    A possible reason for having separate steps 2, 3 and 4 is that d-suffix combinations in
+    English are quite complex, a point which has been made elsewhere.
+
+    But it is hardly surprising that after twenty years of use of the Porter stemmer, certain
+    improvements do suggest themselves, and a new algorithm for English is therefore offered
+    here. (It could be called the 'Porter2' stemmer to distinguish it from the Porter stemmer,
+    from which it derives.) The changes are not so very extensive: (1) terminating y is changed
+    to i rather less often, (2) suffix us does not lose its s, (3) a few additional suffixes
+    are included for removal, including (4) suffix ly. In addition, a small list of exceptional
+    forms is included. In December 2001 there were two further adjustments: (5) Steps 5a and 5b
+    of the old Porter stemmer were combined into a single step. This means that undoubling final
+    ll is not done with removal of final e. (6) In Step 3 ative is removed only when in region R2. 
+
+    To begin with, here is the basic algorithm without reference to the exceptional forms.
+    An exact comparison with the Porter algorithm needs to be done quite carefully if done at
+    all. Here we indicate by * points of departure, and by + additional features.
+    In the sample vocabulary, Porter and Porter2 stem slightly under 5% of words to different forms.
+
+    Dr. Martin Porter
+
+    Define a vowel as one of
+        - a e i o u y 
+
+    Define a double as one of
+        - bb dd ff gg mm nn pp rr tt 
+
+    Define a valid li-ending as one of
+        - c d e g h k m n r t 
+
+    Define a short syllable in a word as either (a) a vowel followed by a non-vowel
+    other than w, x or Y and preceded by a non-vowel, or * (b) a vowel at the beginning
+    of the word followed by a non-vowel.
+
+    So rap, trap, entrap end with a short syllable, and ow, on, at are classed as short syllables.
+    But uproot, bestow, disturb do not end with a short syllable.
+
+    A word is called short if it consists of a short syllable preceded by zero or more consonants.
+    R1 is the region after the first non-vowel following a vowel, or the end of the word if there is no such non-vowel.
+    R2 is the region after the first non-vowel following a vowel in R1, or the end of the word if there is no such non-vowel.
+    If the word has two letters or less, leave it as it is.
+    Otherwise, do each of the following operations,
+    Set initial y, or y after a vowel, to Y, and then establish the regions R1 and R2.
+    
+    \par Algorithm:
+
+    <b>Step 1a:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated:
+            - sses
+                - Replace by ss.
+            - ied+ ies*
+                - Replace by i if preceded by just one letter, otherwise by ie (so ties -> tie, cries -> cri).
+            - s
+                - Delete if the preceding word part contains a vowel not immediately before the s (so gas and this retain the s, gaps and kiwis lose it).
+            - us+ ss
+                - Do nothing.
+
+    <b>Step 1b:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated:
+            - eed eedly+
+                - Replace by ee if in R1.
+            - ed edly+ ing ingly+
+                - Delete if the preceding word part contains a vowel, and then 
+                - If the word ends at, bl or iz add e (so luxuriat -> luxuriate), or 
+                - If the word ends with a double remove the last letter (so hopp -> hop), or 
+                - If the word is short, add e (so hop -> hope).
+
+    <b>Step 1c:</b>
+
+    Replace suffix y or Y by i if preceded by a non-vowel which is
+    not the first letter of the word (so cry -> cri, by -> by, say -> say)
+
+    <b>Step 2:</b>
+
+    Search for the longest among the following suffixes, and, if found and in R1, perform the action indicated:
+            - tional
+                - Replace by tion.
+            - enci
+                - Replace by ence.
+            - anci
+                - Replace by ance 
+            - abli
+                - Replace by able.
+            - entli
+                - Replace by ent.
+            - izer   ization
+                - Replace by ize.
+            - ational   ation   ator
+                - Replace by ate.
+            - alism   aliti   alli
+                - Replace by al.
+            - fulness
+                - Replace by ful.
+            - ousli   ousness
+                - Replace by ous.
+            - iveness   iviti
+                - Replace by ive.
+            - biliti   bli+
+                - Replace by ble. 
+            - ogi+
+                - Replace by og if preceded by l.
+            - fulli+
+                - Replace by ful.
+            - lessli+
+                - Replace by less.
+            - li+
+                - Delete if preceded by a valid li-ending.
+
+    <b>Step 3:</b>
+
+    Search for the longest among the following suffixes, and, if found and in R1, perform the action indicated:
+            - tional+
+                - Replace by tion.
+            - ational+
+                - Replace by ate.
+            - alize
+                - Replace by al.
+            - icate iciti   ical
+                - Replace by ic.
+            - ful ness
+                - Delete.
+            - ative*
+                - Delete if in R2.
+
+    <b>Step 4:</b>
+
+    Search for the longest among the following suffixes, and, if found and in R2, perform the action indicated:
+            - al ance ence er ic able ible ant ement ment ent ism ate iti ous ive ize 
+                - Delete 
+            - ion 
+                - Delete if preceded by s or t.
+
+    <b>Step 5:</b>
+
+    Search for the following suffixes, and, if found, perform the action indicated:
+            - e 
+                - Delete if in R2, or in R1 and not preceded by a short syllable.
+            - l 
+                - Delete if in R2 and preceded by l.
+    */
+    /** @} */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class english_stem : public stem<string_typeT>
+        {
+    public:
+        english_stem() : m_first_vowel(string_typeT::npos)
+            {}
+        //---------------------------------------------
+        /**@param[in,out] text English string to stem.*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                return;
+                }
+
+            //reset internal data
+            m_first_vowel = string_typeT::npos;
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //handle exceptions first
+            if (is_exception(text) )
+                {
+                return;
+                }
+
+            stem<string_typeT>::hash_y(text, L"aeiouyAEIOUY");
+            m_first_vowel = text.find_first_of(L"aeiouyAEIOUY");
+            if (m_first_vowel == string_typeT::npos)
+                { return; }
+
+            if (text.length() >= 5 &&
+                /*gener*/
+                (is_either<wchar_t>(text[0], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                stem<string_typeT>::set_r1(5);
+                }
+            else if (text.length() >= 6 &&
+                /*commun*/
+                (is_either<wchar_t>(text[0], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ) )
+                {
+                stem<string_typeT>::set_r1(6);
+                }
+                       else if (text.length() >= 5 &&
+                /*arsen*/
+                (is_either<wchar_t>(text[0], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ) )
+                {
+                stem<string_typeT>::set_r1(5);
+                }
+            else
+                {
+                stem<string_typeT>::find_r1(text, L"aeiouyAEIOUY");
+                }
+
+            stem<string_typeT>::find_r2(text, L"aeiouyAEIOUY");
+
+            //step 1a:
+            step_1a(text);
+            //exception #2
+            if (is_exception_post_step1a(text) )
+                {
+                return;
+                }
+            //step 1b:
+            step_1b(text);
+            //step 1c:
+            step_1c(text);
+            //step 2:
+            step_2(text);
+            //step 3:
+            step_3(text);
+            //step 4:
+            step_4(text);
+            //step 5:
+            step_5(text);
+
+            stem<string_typeT>::unhash_y(text);
+            }
+    private:
+        //---------------------------------------------
+        bool is_exception(string_typeT& text)
+            {
+            //exception #0
+            /*skis*/
+            if (text.length() == 4 &&
+                is_either<wchar_t>(text[0], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                is_either<wchar_t>(text[1], common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) &&
+                is_either<wchar_t>(text[2], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                is_either<wchar_t>(text[3], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text = L"ski";
+                return true;
+                }
+            /*skies*/
+            else if (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text = L"sky";
+                return true;
+                }
+            /*dying*/
+            else if (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                text = L"die";
+                return true;
+                }
+            /*lying*/
+            else if (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                text = L"lie";
+                return true;
+                }
+            /*tying*/
+            else if (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                text = L"tie";
+                return true;
+                }
+            /*idly*/
+            else if (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"idl";
+                return true;
+                }
+            /*gently*/
+            else if (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"gentl";
+                return true;
+                }
+            /*ugly*/
+            else if (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"ugli";
+                return true;
+                }
+            /*early*/
+            else if (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"earli";
+                return true;
+                }
+            /*only*/
+            else if (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"onli";
+                return true;
+                }
+            /*singly*/
+            else if (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                text = L"singl";
+                return true;
+                }
+            //exception #1
+            else if (
+                /*sky*/
+                (text.length() == 3 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) ) ||
+                /*news*/
+                (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_W, common_lang_constants::UPPER_W) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) ||
+                /*howe*/
+                (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_W, common_lang_constants::UPPER_W) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ) ||
+                /*atlas*/
+                (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) ||
+                /*cosmos*/
+                (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) ||
+                /*bias*/
+                (text.length() == 4 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_B, common_lang_constants::UPPER_B) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) ||
+                /*andes*/
+                (text.length() == 5 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) )
+                {
+                return true;
+                }
+            return false;
+            }
+
+        //---------------------------------------------
+        bool is_exception_post_step1a(string_typeT& text)
+            {
+            //exception #2
+            if (/*inning*/
+                (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ) ||
+                /*outing*/
+                (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ) ||
+                /*canning*/
+                (text.length() == 7 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[6], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ) ||
+                /*herring*/
+                (text.length() == 7 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[6], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ) ||
+                /*earring*/
+                (text.length() == 7 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[6], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ) ||
+                /*proceed*/
+                (text.length() == 7 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[6], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ) ||
+                /*exceed*/
+                (text.length() == 6 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_X, common_lang_constants::UPPER_X) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ) ||
+                /*succeed*/
+                (text.length() == 7 &&
+                    is_either<wchar_t>(text[0], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[1], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) &&
+                    is_either<wchar_t>(text[2], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[3], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                    is_either<wchar_t>(text[4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[5], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[6], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ) )
+                {
+                return true;
+                }
+            return false;
+            }
+        //---------------------------------------------
+        void step_1a(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*sses*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ied*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ||
+                    stem<string_typeT>::is_suffix(text,/*ies*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() == 3 || text.length() == 4)
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 2 &&
+                    is_either<wchar_t>(text[text.length()-1], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                    m_first_vowel < text.length()-2 &&
+                    !string_util::is_one_of(text[text.length()-2], L"suSU") )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_1b(string_typeT& text)
+            {
+            //if the preceding word contains a vowel
+            bool regress_trim = false;
+
+            if (stem<string_typeT>::is_suffix(text,/*eed*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-3)
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*eedly*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ed*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                m_first_vowel < text.length()-2)
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                regress_trim = true;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*edly*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                m_first_vowel < text.length()-4)
+                {
+                text.erase(text.length()-4);
+                stem<string_typeT>::update_r_sections(text);
+                regress_trim = true;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ing*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                m_first_vowel < text.length()-3)
+                {
+                text.erase(text.length()-3);
+                stem<string_typeT>::update_r_sections(text);
+                regress_trim = true;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ingly*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                m_first_vowel < text.length()-5)
+                {
+                text.erase(text.length()-5);
+                stem<string_typeT>::update_r_sections(text);
+                regress_trim = true;
+                }
+            if (regress_trim)
+                {
+                if (stem<string_typeT>::is_suffix(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                    stem<string_typeT>::is_suffix(text,/*bl*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::is_suffix(text,/*iz*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z) )
+                    {
+                    text += common_lang_constants::LOWER_E;
+                    //need to search for r2 again because the 'e' added here may change that
+                    stem<string_typeT>::find_r2(text, L"aeiouyAEIOUY");
+                    }
+                else if (stem<string_typeT>::is_suffix(text,/*bb*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B) ||
+                        stem<string_typeT>::is_suffix(text,/*dd*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) ||
+                        stem<string_typeT>::is_suffix(text,/*ff*/common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_F, common_lang_constants::UPPER_F) ||
+                        stem<string_typeT>::is_suffix(text,/*gg*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) ||
+                        stem<string_typeT>::is_suffix(text,/*mm*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ||
+                        stem<string_typeT>::is_suffix(text,/*nn*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                        stem<string_typeT>::is_suffix(text,/*pp*/common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) ||
+                        stem<string_typeT>::is_suffix(text,/*rr*/common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ||
+                        stem<string_typeT>::is_suffix(text,/*tt*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (is_short_word(text, text.length() ) )
+                    {
+                    text += common_lang_constants::LOWER_E;
+                    //need to search for r2 again because the 'e' added here may change that
+                    stem<string_typeT>::find_r2(text, L"aeiouyAEIOUY");
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_1c(string_typeT& text)
+            {
+            //proceeding consonant cannot be first letter in word
+            if (text.length() > 2 &&
+                !is_vowel(text[text.length()-2]) )
+                {
+                if (is_either<wchar_t>(text[text.length()-1], common_lang_constants::LOWER_Y, LOWER_Y_HASH) )
+                    {
+                    text[text.length()-1] = common_lang_constants::LOWER_I;
+                    }
+                else if (is_either<wchar_t>(text[text.length()-1], common_lang_constants::UPPER_Y, UPPER_Y_HASH) )
+                    {
+                    text[text.length()-1] = common_lang_constants::UPPER_I;
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (text.length() >= 7 &&
+                               (stem<string_typeT>::is_suffix(text,/*ization*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                               stem<string_typeT>::is_suffix(text,/*ational*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-7)
+                    {
+                    text.erase(text.length()-4);
+                    text[static_cast<int>(text.length()-1)] = common_lang_constants::LOWER_E;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 7 &&
+                               (stem<string_typeT>::is_suffix(text,/*fulness*/common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                               stem<string_typeT>::is_suffix(text,/*ousness*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                               stem<string_typeT>::is_suffix(text,/*iveness*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-7)
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 6 &&
+                               (stem<string_typeT>::is_suffix(text,/*tional*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                               stem<string_typeT>::is_suffix(text,/*lessli*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-6)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 6 && stem<string_typeT>::is_suffix(text,/*biliti*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-6)
+                    {
+                    text.erase(text.length()-3);
+                    text[text.length()-2] = common_lang_constants::LOWER_L;
+                    text[text.length()-1] = common_lang_constants::LOWER_E;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 5 &&
+                               (stem<string_typeT>::is_suffix(text,/*iviti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*ation*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-2);
+                    text[text.length()-1] = common_lang_constants::LOWER_E;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 5 &&
+                               (stem<string_typeT>::is_suffix(text,/*alism*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ||
+                               stem<string_typeT>::is_suffix(text,/*aliti*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 5 &&
+                               (stem<string_typeT>::is_suffix(text,/*ousli*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*entli*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*fulli*/common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 && stem<string_typeT>::is_suffix(text,/*alli*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 &&
+                               (stem<string_typeT>::is_suffix(text,/*enci*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*anci*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*abli*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text[text.length()-1] = common_lang_constants::LOWER_E;
+                    }
+                }
+            else if (text.length() >= 4 && stem<string_typeT>::is_suffix(text,/*izer*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 && stem<string_typeT>::is_suffix(text,/*ator*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-1);
+                    text[text.length()-1] = common_lang_constants::LOWER_E;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 3 &&
+                stem<string_typeT>::get_r1() <= (text.length()-3) &&
+                stem<string_typeT>::is_suffix(text,/*bli*/common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                text[text.length()-1] = common_lang_constants::LOWER_E;
+                }
+            else if (text.length() >= 3 &&
+                stem<string_typeT>::get_r1() <= (text.length()-3) &&
+                stem<string_typeT>::is_suffix(text,/*ogi*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 2 &&
+                    stem<string_typeT>::get_r1() <= (text.length()-2) &&
+                    stem<string_typeT>::is_suffix(text,/*li*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (string_util::is_one_of(text[text.length()-3], L"cdeghkmnrtCDEGHKMNRT") )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text) 
+            {
+            if (text.length() >= 7 && stem<string_typeT>::is_suffix(text,/*ational*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-7)
+                    {
+                    text.erase(text.length()-4);
+                    text[text.length()-1] = common_lang_constants::LOWER_E;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 6 && stem<string_typeT>::is_suffix(text,/*tional*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-6)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 5 &&
+                               (stem<string_typeT>::is_suffix(text,/*icate*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                               stem<string_typeT>::is_suffix(text,/*iciti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                               stem<string_typeT>::is_suffix(text,/*alize*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 5 && stem<string_typeT>::is_suffix(text,/*ative*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 && stem<string_typeT>::is_suffix(text,/*ical*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 && stem<string_typeT>::is_suffix(text,/*ness*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 3 && stem<string_typeT>::is_suffix(text,/*ful*/common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_4(string_typeT& text)
+            {
+            if (text.length() >= 5 &&
+                stem<string_typeT>::is_suffix(text,/*ement*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 &&
+                    (stem<string_typeT>::is_suffix(text,/*able*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_suffix(text,/*ible*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_suffix(text,/*ment*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                    stem<string_typeT>::is_suffix(text,/*ence*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_suffix(text,/*ance*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E)) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 4 &&
+                    (stem<string_typeT>::is_suffix(text,/*sion*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                    stem<string_typeT>::is_suffix(text,/*tion*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N)) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 3 &&
+                    (stem<string_typeT>::is_suffix(text,/*ant*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                    stem<string_typeT>::is_suffix(text,/*ent*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                    stem<string_typeT>::is_suffix(text,/*ism*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) ||
+                    stem<string_typeT>::is_suffix(text,/*ate*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_suffix(text,/*iti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::is_suffix(text,/*ous*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                    stem<string_typeT>::is_suffix(text,/*ive*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_suffix(text,/*ize*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E)) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (text.length() >= 2 &&
+                    (stem<string_typeT>::is_suffix(text,/*al*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::is_suffix(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ||
+                    stem<string_typeT>::is_suffix(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C)) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_5(string_typeT& text)
+            {
+            if (text.length() >= 1 &&
+                is_either<wchar_t>(text[text.length()-1], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::get_r2() != text.length())
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (stem<string_typeT>::get_r1() != text.length() &&
+                    text.length() >= 2 &&
+                    //look at the part of the word in front of the last 'e' to see if it ends with
+                    //a short syllable.
+                    !ends_with_short_syllable(text, text.length()-1))
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (stem<string_typeT>::get_r2() != text.length() &&
+                stem<string_typeT>::is_suffix(text,/*ll*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        /**Define a short syllable in a word as either
+        (a) a vowel followed by a non-vowel other than w, x or Y and preceded by a non-vowel, or 
+        (b) a vowel at the beginning of the word followed by a non-vowel.
+
+        So rap, trap, entrap end with a short syllable, and ow, on, at are classed as short syllables.
+        But uproot, bestow, disturb do not end with a short syllable.*/
+        //---------------------------------------------
+        bool ends_with_short_syllable(const string_typeT& text, const size_t length) const
+            {
+            if (length == 2)
+                {
+                if (is_vowel(text[0]) )
+                    { return (!is_vowel(text[1]) ); }
+                else
+                    { return false; }
+                }
+            else if (length > 2)
+                {
+                size_t start = text.find_last_of(L"aeiouyAEIOUY", length-1);
+                if (start == string_typeT::npos)
+                    { return false; }
+                if (start > 0 &&
+                    start == (length-2) &&
+                    //following letter
+                    (!is_vowel(text[start+1]) &&
+                    !string_util::is_one_of(text[start+1], L"wxWX") &&
+                    is_neither(text[start+1], LOWER_Y_HASH, UPPER_Y_HASH)) &&
+                    //proceeding letter
+                    !is_vowel(text[start-1]) )
+                    { return true; }
+                else
+                    { return false; }
+                }
+            else
+                { return false; }
+            }
+        ///A word is called short if it ends in a short syllable, and if R1 is null.
+        //---------------------------------------------
+        inline bool is_short_word(const string_typeT& text, const size_t length) const
+            { return (ends_with_short_syllable(text, length) && stem<string_typeT>::get_r1() == text.length()); }
+        //---------------------------------------------
+        inline bool is_vowel(const wchar_t character) const
+            { return (string_util::is_one_of(character, L"aeiouyAEIOUY") ); }
+
+        size_t m_first_vowel;
+        };
+    }
+
+#endif //__ENGLISH_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/finnish_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/finnish_stem.h
new file mode 100644 (file)
index 0000000..5f1b87a
--- /dev/null
@@ -0,0 +1,546 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __FINNISH_STEM_H__
+#define __FINNISH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class finnish_stem
+        Finnish stemming class.
+
+    Finnish is not an Indo-European language, but belongs to the Finno-Ugric group,
+    which again belongs to the Uralic group. Distinctions between a-, i- and d-suffixes
+    can be made in Finnish, but they are much less sharply separated than in an
+    Indo-European language. The system of endings is extremely elaborate, but strictly
+    defined, and applies equally to all nominals, that is, to nouns, adjectives and pronouns.
+    Verb endings have a close similarity to nominal endings, which again makes Finnish
+    very different from any Indo-European language.
+
+    More problematical than the endings themselves is the change that can be effected in a
+    stem as a result of taking a particular ending. A stem typically has two forms
+    ,strong and weak, where one class of ending follows the strong form and the complementary
+    class the weak. Normalising strong and weak forms after ending removal is not generally possible,
+    although the common case where strong and weak forms only differ in the single or double form of
+    a final consonant can be dealt with.
+
+    Finnish includes the following accented forms:
+        - ä ö
+
+    The following letters are vowels:
+        - a e i o u y ä ö
+
+    R1 and R2 are then defined in the usual way.
+
+    \par Algorithm:
+
+    <b>Step 1 (particles etc.):</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated:
+
+    - kin kaan kään ko kö han hän pa pä
+        - Delete if preceded by n, t or a vowel.
+    - sti
+        - Delete if in R2.
+        (Of course, the n, t or vowel of 1(a) need not be in R1:
+        only the suffix removed must be in R1. And similarly below.
+
+    <b>Step 2 (possessives):</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated:
+
+    - si
+        - Delete if not preceded by k.
+    - ni
+        - Delete. If preceded by kse, replace with ksi.
+    - nsa nsä mme nne
+        - Delete.
+    - an
+        - Delete if preceded by one of:   ta   ssa   sta   lla   lta   na.
+    - än
+        - Delete if preceded by one of: tä ssä stä llä ltä nä.
+    - en
+        - Delete if preceded by one of:   lle   ine.
+
+    <b>Step 3 (cases):</b>
+
+    Define a v (vowel) as one of:
+        - a   e   i   o   u   y   ä ö.
+
+    Define a V (restricted vowel) as one of:
+        - a   e   i   o   u   ä ö.
+
+    So Vi means a V followed by letter i.
+
+    Define LV (long vowel) as one of:
+        - aa   ee   ii   oo   uu   ää öö.
+
+    Define a c (consonant) as a character other than a v.
+    So cv means a c followed by a v.
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated:
+
+    - hXn   (preceded by X, where X is a V, other than u [a/han, e/hen etc]) 
+    - siin   den   tten   (preceded by Vi)
+    - seen   (preceded by LV)
+    - a ä    (preceded by cv)
+    - tta   ttä   (preceded by e)
+    - ta   tä   ssa   ssä   sta   stä   lla   llä   lta   ltä   lle   na   nä   ksi   ine
+        - Delete.
+    - n
+        - Delete, and if preceded by LV or ie, delete the last vowel.
+
+    <b>Step 4 (other endings):</b>
+
+    Search for the longest among the following suffixes in R2, and perform the action indicated:
+
+    - mpi   mpa   mpä   mmi   mma   mmä
+        - Delete if not preceded by po.
+    - impi   impa   impä   immi   imma   immä   eja   ejä 
+        - Delete.
+
+    <b>Step 5 (plurals): </b>
+
+    If an ending was removed in step 3, delete a final 'i' or 'j' if in R1;
+    otherwise, if an ending was not removed in step 3,
+    then delete the final 't' in R1 if it follows a vowel, and, if a 't' is removed,
+    then delete a final "mma" or "imma" in R2, unless the "mma" is preceded by "po".
+
+    <b>Step 6 (tidying up):</b>
+
+    Perform steps (a), (b), (c), (d), restricting all tests to the R1 region.
+
+    <b>Step 6(a):</b>
+
+    If R1 ends with LV then delete the last letter.
+
+    <b>Step 6(b):</b>
+
+    If R1 ends with cX, c a consonant and X one of:
+    - a   ä   e   i
+        -Delete the last letter.
+
+    <b>Step 6(c):</b>
+
+    If R1 ends with oj or uj, then delete the last letter.
+
+    <b>Step 6(d):</b>
+
+    If R1 ends with jo then, delete the last letter.
+
+    <b>Step 6(e):</b>
+
+    This is not restricted to R1. If the word ends with a double consonant followed by zero or more vowels,
+    then remove the last consonant (so eläkk -> eläk, aatonaatto -> aatonaato).
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class finnish_stem : public stem<string_typeT>
+        {
+    public:
+        finnish_stem() : m_step_3_successful(false) {}
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 2)
+                {
+                return;
+                }
+
+            //reset internal data
+            m_step_3_successful = false;
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            stem<string_typeT>::find_r1(text, FINNISH_VOWELS);
+            stem<string_typeT>::find_r2(text, FINNISH_VOWELS);
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+            step_4(text);
+            step_5(text);
+            step_6(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*kaan*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*kään*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (text.length() >= 5 &&
+                    string_util::is_one_of(text[text.length()-5], FINNISH_STEP_1_SUFFIX) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*kin*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*han*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hän*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (text.length() >= 4 &&
+                    string_util::is_one_of(text[text.length()-4], FINNISH_STEP_1_SUFFIX) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*sti*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text,/*sti*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*ko*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*kö*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_O_UMLAUTS, common_lang_constants::UPPER_O_UMLAUTS) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*pa*/common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*pä*/common_lang_constants::LOWER_P, common_lang_constants::UPPER_P,common_lang_constants:: LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) )
+                {
+                if (text.length() >= 3 &&
+                    string_util::is_one_of(text[text.length()-3], FINNISH_STEP_1_SUFFIX) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*nsa*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*nsä*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*mme*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*nne*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*si*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (text.length() >= 3 &&
+                    !(text[text.length()-3] == common_lang_constants::LOWER_K || text[text.length()-3] == common_lang_constants::UPPER_K))
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ni*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text, /*kse*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text[text.length()-1] = common_lang_constants::LOWER_I;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*an*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if ((text.length() >= 4 &&
+                    (stem<string_typeT>::is_partial_suffix(text, (text.length()-4), common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-4), common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A)) ) ||
+                    (text.length() >= 5 &&
+                    (stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ) ) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*än*/common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if ((text.length() >= 4 &&
+                    (stem<string_typeT>::is_partial_suffix(text, (text.length()-4), common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-4), common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS)) ) ||
+                    (text.length() >= 5 &&
+                    (stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ) ) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (text.length() >= 5 &&
+                    (stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::is_partial_suffix(text, (text.length()-5), common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text)
+            {
+            //seen followed by LV
+            if (text.length() >= 6 &&
+                stem<string_typeT>::is_suffix_in_r1(text,/*seen*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                string_util::is_one_of(text[text.length()-5], FINNISH_VOWELS_NO_Y) &&
+                string_util::tolower_western(text[text.length()-5]) == string_util::tolower_western(text[text.length()-6]) )
+                {
+                text.erase(text.length()-4);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_3_successful = true;
+                return;
+                }
+            //suffix followed by Vi
+            else if (text.length() >= 6 &&
+                    is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    (stem<string_typeT>::is_suffix_in_r1(text,/*siin*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                    stem<string_typeT>::is_suffix_in_r1(text,/*tten*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ) &&
+                    string_util::is_one_of(text[text.length()-6], FINNISH_VOWELS_NO_Y) )
+                {
+                text.erase(text.length()-4);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_3_successful = true;
+                return;
+                }
+            //suffix followed by Vi
+            else if (text.length() >= 5 &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    stem<string_typeT>::is_suffix_in_r1(text,/*den*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    string_util::is_one_of(text[text.length()-5], FINNISH_VOWELS_NO_Y) )
+                {
+                text.erase(text.length()-3);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_3_successful = true;
+                return;
+                }
+            else if ((stem<string_typeT>::is_suffix_in_r1(text,/*tta*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*ttä*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS)) &&
+                is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                text.erase(text.length()-3);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_3_successful = true;
+                return;
+                }
+            //ends if VHVN
+            else if (
+                (stem<string_typeT>::is_suffix_in_r1(text,/*han*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hen*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hin*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hon*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hän*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*hön*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_O_UMLAUTS, common_lang_constants::UPPER_O_UMLAUTS, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ) )
+                {
+                if (string_util::tolower_western(text[text.length()-2]) == string_util::tolower_western(text[text.length()-4]) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_3_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ssa*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*ssä*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*sta*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*stä*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*lla*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*llä*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*lta*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*ltä*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*lle*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*ksi*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*ine*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*na*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*nä*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) )
+                {
+                m_step_3_successful = true;
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ta*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r1(text,/*tä*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) )
+                {
+                m_step_3_successful = true;
+                return;
+                }
+            //suffix followed by cv
+            else if (text.length() >= 3 &&
+                    (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) || stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ) &&
+                    !string_util::is_one_of(text[text.length()-3], FINNISH_VOWELS) &&
+                    string_util::is_one_of(text[text.length()-2], FINNISH_VOWELS) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_3_successful = true;
+                return;
+                }
+            //suffix followed by LV or ie
+            else if (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                if (text.length() >= 2 &&
+                    ((string_util::is_one_of(text[text.length()-1], FINNISH_VOWELS_NO_Y) &&
+                      string_util::tolower_western(text[text.length()-1]) == string_util::tolower_western(text[text.length()-2])) ||
+                     stem<string_typeT>::is_suffix_in_r1(text,/*ie*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E)) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                m_step_3_successful = true;
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_4(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r2(text,/*impi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*impa*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*impä*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*immi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*imma*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*immä*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*eja*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ejä*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS, false) )
+                {
+                return;
+                }
+            else if (text.length() >= 5 &&
+                    (stem<string_typeT>::is_suffix_in_r2(text,/*mpi*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::is_suffix_in_r2(text,/*mpa*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_suffix_in_r2(text,/*mpä*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_P, common_lang_constants::UPPER_P, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ||
+                    stem<string_typeT>::is_suffix_in_r2(text,/*mmi*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::is_suffix_in_r2(text,/*mma*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::is_suffix_in_r2(text,/*mmä*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A_UMLAUTS, common_lang_constants::UPPER_A_UMLAUTS) ) )
+                {
+                if (!(is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            return;
+            }
+        //---------------------------------------------
+        void step_5(string_typeT& text)
+            {
+            //if step 3 was successful in removing a suffix
+            if (m_step_3_successful)
+                {
+                if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J) )
+                    {
+                    //NOOP
+                    }
+                }
+            else
+                {
+                if (text.length() >= 2 &&
+                    string_util::is_one_of(text[text.length()-2], FINNISH_VOWELS) )
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                        {
+                        if (!stem<string_typeT>::delete_if_is_in_r2(text,/*imma*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                            {
+                            if (text.length() >= 5 &&
+                                stem<string_typeT>::is_suffix_in_r2(text,/*mma*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                                //isn't proceeded by "po"
+                                !(is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) &&
+                                is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                                {
+                                text.erase(text.length()-3);
+                                stem<string_typeT>::update_r_sections(text);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_6(string_typeT& text)
+            {
+            step_6a(text);
+            step_6b(text);
+            step_6c(text);
+            step_6d(text);
+            step_6e(text);
+            }
+        //---------------------------------------------
+        void step_6a(string_typeT& text)
+            {
+            if (text.length() >= 2 &&
+                stem<string_typeT>::get_r1() <= text.length()-2 &&
+                string_util::is_one_of(text[text.length()-1], FINNISH_VOWELS_NO_Y) &&
+                string_util::tolower_western(text[text.length()-1]) == string_util::tolower_western(text[text.length()-2]))
+                {
+                text.erase(text.end()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_6b(string_typeT& text)
+            {
+            if (text.length() >= 2 &&
+                stem<string_typeT>::get_r1() <= text.length()-2 &&
+                !string_util::is_one_of(text[text.length()-2], FINNISH_VOWELS) &&
+                string_util::is_one_of(text[text.length()-1], FINNISH_VOWELS_SIMPLE) )
+                {
+                text.erase(text.end()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_6c(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*oj*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J) ||
+                stem<string_typeT>::is_suffix_in_r1(text,/*uj*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_J, common_lang_constants::UPPER_J) )
+                {
+                text.erase(text.end()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_6d(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*jo*/common_lang_constants::LOWER_J, common_lang_constants::UPPER_J, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                text.erase(text.end()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_6e(string_typeT& text)
+            {
+            //find the last consonant
+            size_t index = text.find_last_not_of(FINNISH_VOWELS);
+            if (index == string_typeT::npos ||
+                index < 1)
+                { return; }
+            if (string_util::tolower_western(text[index]) == string_util::tolower_western(text[index-1]))
+                {
+                text.erase(text.begin()+(index) );
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //internal data specific to Finnish stemmer
+        bool m_step_3_successful;
+        };
+    }
+
+#endif //__FINNISH_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/french_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/french_stem.h
new file mode 100644 (file)
index 0000000..1d2ae03
--- /dev/null
@@ -0,0 +1,1397 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __FRENCH_STEM_H__
+#define __FRENCH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class french_stem
+        French stemming class.
+
+
+    Letters in French include the following accented forms:
+        - â à ç ë é ê è ï î ô û ù 
+
+    The following letters are vowels:
+        - a e i o u y â à ë é ê è ï î ô û ù
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated.
+        - ance iqUe isme able iste eux ances iqUes ismes ables istes
+            - Delete if in R2.
+        - atrice ateur ation atrices ateurs ations
+            - Delete if in R2.
+            - If preceded by ic, delete if in R2, else replace by iqU.
+        - logie logies
+            - Replace with log if in R2.
+        - usion ution usions utions
+            - Replace with u if in R2.
+        -ence ences
+            - Replace with ent if in R2.
+        - ement ements
+            - Delete if in RV
+            - If preceded by iv, delete if in R2 (and if further preceded by at, delete if in R2), otherwise,
+            - If preceded by eus, delete if in R2, else replace by eux if in R1, otherwise,
+            - If preceded by abl or iqU, delete if in R2, otherwise,
+        - If preceded by ièr or Ièr, replace by i if in RV
+        - ité ités
+            - Delete if in R2
+            - If preceded by abil, delete if in R2, else replace by abl, otherwise,
+            - If preceded by ic, delete if in R2, else replace by iqU, otherwise,
+            - If preceded by iv, delete if in R2
+            - If ive ifs ives, delete if in R2
+            - If preceded by "at", delete if in R2 (and if further preceded by ic, delete if in R2, else replace by iqU).
+        - eaux
+            - Replace with eau.
+        - aux
+            - Replace with al if in R1.
+        - euse euses
+            - Delete if in R2, else replace by eux if in R1.
+        - issement issements
+            - Delete if in R1 and preceded by a non-vowel.
+        - amment
+            - Replace with ant if in RV.
+        - emment
+            - Replace with ent if in RV.
+        -ment ments
+            - Delete if preceded by a vowel in RV.
+
+    In steps 2(a) and 2(b) all tests are confined to the RV region.
+
+    Do step 2(a) if either no ending was removed by step 1, or if one of endings amment, emment, ment, ments was found.
+
+    <b>Step 2(a):</b>
+
+    Search for the longest among the following suffixes and if found, delete if preceded by a non-vowel:
+
+        - îmes ît îtes i ie ies ir ira irai iraIent irais irait iras irent irez iriez irions irons iront is issaIent
+        issais issait issant issante issantes issants isse issent isses issez issiez issions issons it
+
+    (Note that the non-vowel itself must also be in RV).
+
+    Do step 2b if step 2a was done, but failed to remove a suffix.
+
+    <b>Step 2(b):</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated. 
+        - ions
+            - Delete if in R2.
+        - é ée ées és èrent er era erai eraIent erais erait eras erez eriez erions erons eront ez iez
+            - Delete.
+        - âmes ât âtes a ai aIent ais ait ant ante antes ants as asse assent asses assiez assions
+            - Delete.
+            - If preceded by e, delete.
+
+    (Note that the e that may be deleted in this last step must also be in RV).
+
+    If the last step to be obeyed - either step 1, 2a or 2b - altered the word, do step 3.
+
+    <b>Step 3:</b>
+
+    Replace final Y with i or final ç with c.
+
+    Alternatively, if the last step to be obeyed did not alter the word, do step 4.
+
+    <b>Step 4:</b>
+
+    If the word ends s, not preceded by a, i, o, u, è or s, delete it. 
+
+    In the rest of step 4, all tests are confined to the RV region.
+
+    Search for the longest among the following suffixes, and perform the action indicated:
+        - ion
+            - Delete if in R2 and preceded by s or t.
+        - ier ière Ier Ière
+            - Replace with i.
+        - e
+            - Delete.
+        - ë 
+            - If preceded by gu, delete.
+
+    (So note that ion is removed only when it is in R2 - as well as being in RV -
+    and preceded by s or t which must be in RV).
+
+    <b>Step 5:</b>
+
+    If the word ends enn, onn, ett, ell or eill, then delete the last letter.
+
+    <b>Step 6:</b>
+
+    If the words ends with é or è followed by at least one non-vowel, then remove the accent from the 'e'.
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class french_stem : public stem<string_typeT>
+        {
+    public:
+        french_stem() : m_step_1_successful(false) {}
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 2)
+                {
+                return;
+                }
+
+            //reset internal data
+            m_step_1_successful = false;
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+            stem<string_typeT>::hash_french_yui(text, FRENCH_VOWELS);
+
+            stem<string_typeT>::find_r1(text, FRENCH_VOWELS);
+            stem<string_typeT>::find_r2(text, FRENCH_VOWELS);
+            stem<string_typeT>::find_french_rv(text, FRENCH_VOWELS);
+
+            size_t length = text.length();
+            step_1(text);
+            if (!m_step_1_successful)
+                {
+                step_2a(text);
+                }
+            if (length != text.length() )
+                {
+                step_3(text);
+                }
+            else
+                {
+                step_4(text);
+                }
+            step_5(text);
+            step_6(text);
+
+            stem<string_typeT>::unhash_french_yui(text);
+            }
+    private:
+        bool ic_to_iqu(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return true;
+                    }
+                else
+                    {
+                    text.erase(text.length()-2);
+                    text += L"iq";
+                    text += LOWER_U_HASH;
+                    //need to search for r2 again because the 'iq' added here may change that
+                    stem<string_typeT>::find_r2(text, FRENCH_VOWELS);
+                    stem<string_typeT>::find_french_rv(text, FRENCH_VOWELS);
+                    return true;
+                    }
+                }
+            return false;
+            }
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            size_t length = text.length();
+            if (stem<string_typeT>::is_suffix(text,/*issements*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 10 &&
+                    stem<string_typeT>::get_r1() <= (text.length()-9) &&
+                    !string_util::is_one_of(text[text.length()-10], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-9);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*issement*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 9 &&
+                    stem<string_typeT>::get_r1() <= (text.length()-8) &&
+                    !string_util::is_one_of(text[text.length()-9], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-8);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            //7
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*atrices*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (length != text.length() )
+                    {
+                    ic_to_iqu(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            //6
+            else if (stem<string_typeT>::is_suffix(text,/*amment*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (stem<string_typeT>::get_rv() <= (text.length()-6) )
+                    {
+                    text.replace(text.end()-5, text.end(), L"nt");
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*emment*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (stem<string_typeT>::get_rv() <= (text.length()-6) )
+                    {
+                    text.replace(text.end()-5, text.end(), L"nt");
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*logies*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-6) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*atrice*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ateurs*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ations*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (length != text.length() )
+                    {
+                    ic_to_iqu(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*usions*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                    stem<string_typeT>::is_suffix(text,/*utions*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-6) )
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ements*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    }
+                else if (stem<string_typeT>::is_suffix(text,/*eus*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-3)
+                        {
+                        text.erase(text.length()-3);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else if (stem<string_typeT>::get_r1() <= text.length()-3)
+                        {
+                        text[text.length()-1] = common_lang_constants::LOWER_X;
+                        }
+                    }
+                else if (stem<string_typeT>::delete_if_is_in_r2(text,/*abl*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    //NOOP
+                    }
+                else if (text.length() >= 3 &&
+                    (text[text.length()-3] == common_lang_constants::LOWER_I || text[text.length()-3] == common_lang_constants::UPPER_I) &&
+                    (text[text.length()-2] == common_lang_constants::LOWER_Q || text[text.length()-2] == common_lang_constants::UPPER_Q) &&
+                    is_either<wchar_t>(text[text.length()-1], LOWER_U_HASH, UPPER_U_HASH) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-3)
+                        {
+                        text.erase(text.length()-3);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    }
+                else if (stem<string_typeT>::is_suffix_in_rv(text,/*ièr*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E_GRAVE, common_lang_constants::UPPER_E_GRAVE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-3) &&
+                    (text[text.length()-2] == common_lang_constants::LOWER_E_GRAVE || text[text.length()-2] == common_lang_constants::UPPER_E_GRAVE) &&
+                    (text[text.length()-1] == common_lang_constants::LOWER_R || text[text.length()-1] == common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[text.length()-3], LOWER_I_HASH, UPPER_I_HASH) )
+                    {
+                    text.replace(text.end()-3, text.end(), L"i");
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            //5
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ateur*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ation*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                if (length != text.length() )
+                    {
+                    ic_to_iqu(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*usion*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                    stem<string_typeT>::is_suffix(text,/*ution*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-5) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ences*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-5) )
+                    {
+                    text.replace(text.end()-3, text.end(), L"t");
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ables*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*istes*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ismes*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ances*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (text.length() >= 5 &&
+                    (text[text.length()-5] == common_lang_constants::LOWER_I || text[text.length()-5] == common_lang_constants::UPPER_I) &&
+                    (text[text.length()-4] == common_lang_constants::LOWER_Q || text[text.length()-4] == common_lang_constants::UPPER_Q) &&
+                    (text[text.length()-2] == common_lang_constants::LOWER_E || text[text.length()-2] == common_lang_constants::UPPER_E) &&
+                    (text[text.length()-1] == common_lang_constants::LOWER_S || text[text.length()-1] == common_lang_constants::UPPER_S) &&
+                    is_either<wchar_t>(text[text.length()-3], LOWER_U_HASH, UPPER_U_HASH) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-5)
+                        {
+                        text.erase(text.length()-5);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    if (length != text.length() )
+                        {
+                        m_step_1_successful = true;
+                        }
+                    return;
+                    }
+            else if (stem<string_typeT>::is_suffix(text,/*logie*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-5) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ement*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text, /*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    }
+                else if (stem<string_typeT>::is_suffix(text,/*eus*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                    {
+                    if (text.length() >= 3 &&
+                        stem<string_typeT>::get_r2() <= text.length()-3)
+                        {
+                        text.erase(text.length()-3);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else if (text.length() >= 3 &&
+                        stem<string_typeT>::get_r1() <= text.length()-3)
+                        {
+                        text[text.length()-1] = common_lang_constants::LOWER_X;
+                        }
+                    }
+                else if (stem<string_typeT>::delete_if_is_in_r2(text,/*abl*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    //NOOP
+                    }
+                else if (text.length() >= 3 &&
+                    (text[text.length()-3] == common_lang_constants::LOWER_I || text[text.length()-3] == common_lang_constants::UPPER_I) &&
+                    (text[text.length()-2] == common_lang_constants::LOWER_Q || text[text.length()-2] == common_lang_constants::UPPER_Q) &&
+                    is_either<wchar_t>(text[text.length()-1], LOWER_U_HASH, UPPER_U_HASH) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-3)
+                        {
+                        text.erase(text.length()-3);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    }
+                else if (stem<string_typeT>::is_suffix_in_rv(text,/*ièr*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E_GRAVE, common_lang_constants::UPPER_E_GRAVE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-3) &&
+                    (text[text.length()-2] == common_lang_constants::LOWER_E_GRAVE || text[text.length()-2] == common_lang_constants::UPPER_E_GRAVE) &&
+                    (text[text.length()-1] == common_lang_constants::LOWER_R || text[text.length()-1] == common_lang_constants::UPPER_R) &&
+                    is_either<wchar_t>(text[text.length()-3], LOWER_I_HASH, UPPER_I_HASH) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ments*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //the proceeding vowel must also be n RV
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= text.length()-6 &&
+                    string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*euses*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (stem<string_typeT>::get_r1() <= text.length()-5)
+                    {
+                    text.replace(text.end()-3, text.end(), L"x");
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                m_step_1_successful = true;
+                }
+            //4
+            else if (stem<string_typeT>::is_suffix(text,/*euse*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::get_r2() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                else if (text.length() >= 4 &&
+                    stem<string_typeT>::get_r1() <= text.length()-4)
+                    {
+                    text.replace(text.end()-2, text.end(), L"x");
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                m_step_1_successful = true;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ment*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                //the proceeding vowel must also be n RV
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= text.length()-5 &&
+                    string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ence*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::get_r2() <= (text.length()-4) )
+                    {
+                    text.replace(text.end()-2, text.end(), L"t");
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ance*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*isme*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*able*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iste*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (text.length() >= 4 &&
+                    (text[text.length()-4] == common_lang_constants::LOWER_I || text[text.length()-4] == common_lang_constants::UPPER_I) &&
+                    (text[text.length()-3] == common_lang_constants::LOWER_Q || text[text.length()-3] == common_lang_constants::UPPER_Q) &&
+                    (text[text.length()-1] == common_lang_constants::LOWER_E || text[text.length()-1] == common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-2], LOWER_U_HASH, UPPER_U_HASH) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-4)
+                        {
+                        text.erase(text.length()-4);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    if (length != text.length() )
+                        {
+                        m_step_1_successful = true;
+                        }
+                    return;
+                    }
+            else if (stem<string_typeT>::is_suffix(text,/*eaux*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_X, common_lang_constants::UPPER_X) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                m_step_1_successful = true;
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ités*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-4)
+                        {
+                        text.erase(text.length()-4);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else
+                        {
+                        text.replace(text.end()-2, text.end(), L"l");
+                        }
+                    }
+                else if (stem<string_typeT>::is_suffix(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-2)
+                        {
+                        text.erase(text.length()-2);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else
+                        {
+                        text.erase(text.length()-2);
+                        text += L"iq";
+                        text += LOWER_U_HASH;
+                        //need to search for r2 again because the 'iq' added here may change that
+                        stem<string_typeT>::find_r2(text, FRENCH_VOWELS);
+                        stem<string_typeT>::find_french_rv(text, FRENCH_VOWELS);
+                        }
+                    }
+                else
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ives*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    ic_to_iqu(text);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            //3
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ité*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-4)
+                        {
+                        text.erase(text.length()-4);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else
+                        {
+                        text.replace(text.end()-2, text.end(), L"l");
+                        }
+                    }
+                else if (stem<string_typeT>::is_suffix(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) )
+                    {
+                    if (stem<string_typeT>::get_r2() <= text.length()-2)
+                        {
+                        text.erase(text.length()-2);
+                        stem<string_typeT>::update_r_sections(text);
+                        }
+                    else
+                        {
+                        text.erase(text.length()-2);
+                        text += L"iq";
+                        text += LOWER_U_HASH;
+                        //need to search for r2 again because the 'iq' added here may change that
+                        stem<string_typeT>::find_r2(text, FRENCH_VOWELS);
+                        stem<string_typeT>::find_french_rv(text, FRENCH_VOWELS);
+                        }
+                    }
+                else
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*eux*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_X, common_lang_constants::UPPER_X, false) )
+                {
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*aux*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_X, common_lang_constants::UPPER_X) )
+                {
+                if (stem<string_typeT>::get_r1() <= (text.length()-3) )
+                    {
+                    text.replace(text.end()-2, text.end(), L"l");
+                    stem<string_typeT>::update_r_sections(text);
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ive*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ifs*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                    {
+                    ic_to_iqu(text);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            //2
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*if*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, false) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                    {
+                    ic_to_iqu(text);
+                    }
+                if (length != text.length() )
+                    {
+                    m_step_1_successful = true;
+                    }
+                return;
+                }
+            }
+         //---------------------------------------------
+        void step_2a(string_typeT& text)
+            {
+            if (text.length() >= 9 &&
+                stem<string_typeT>::get_rv() <= (text.length()-8) &&
+                (text[text.length()-8] == common_lang_constants::LOWER_I || text[text.length()-8] == common_lang_constants::UPPER_I) &&
+                (text[text.length()-7] == common_lang_constants::LOWER_S || text[text.length()-7] == common_lang_constants::UPPER_S) &&
+                (text[text.length()-6] == common_lang_constants::LOWER_S || text[text.length()-6] == common_lang_constants::UPPER_S) &&
+                (text[text.length()-5] == common_lang_constants::LOWER_A || text[text.length()-5] == common_lang_constants::UPPER_A) &&
+                (text[text.length()-3] == common_lang_constants::LOWER_E || text[text.length()-3] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_N || text[text.length()-2] == common_lang_constants::UPPER_N) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_T || text[text.length()-1] == common_lang_constants::UPPER_T) &&
+                is_either<wchar_t>(text[text.length()-4], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                if (stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-9], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-8);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issantes*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 9 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-9) &&
+                    !string_util::is_one_of(text[text.length()-9], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-8);
+                    return;
+                    }
+                }
+            else if (text.length() >= 8 &&
+                stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                (text[text.length()-7] == common_lang_constants::LOWER_I || text[text.length()-7] == common_lang_constants::UPPER_I) &&
+                (text[text.length()-6] == common_lang_constants::LOWER_R || text[text.length()-6] == common_lang_constants::UPPER_R) &&
+                (text[text.length()-5] == common_lang_constants::LOWER_A || text[text.length()-5] == common_lang_constants::UPPER_A) &&
+                (text[text.length()-3] == common_lang_constants::LOWER_E || text[text.length()-3] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_N || text[text.length()-2] == common_lang_constants::UPPER_N) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_T || text[text.length()-1] == common_lang_constants::UPPER_T) &&
+                is_either<wchar_t>(text[text.length()-4], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                if (stem<string_typeT>::get_rv() <= (text.length()-8) &&
+                    !string_util::is_one_of(text[text.length()-8], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-7);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issante*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (text.length() >= 8 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-8) &&
+                    !string_util::is_one_of(text[text.length()-8], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-7);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issants*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 8 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-8) &&
+                    !string_util::is_one_of(text[text.length()-8], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-7);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issions*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 8 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-8) &&
+                    !string_util::is_one_of(text[text.length()-8], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-7);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irions*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issais*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issait*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issant*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issent*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issiez*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issons*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 7 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                    !string_util::is_one_of(text[text.length()-7], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-6);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irais*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irait*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irent*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*iriez*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irons*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*iront*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*isses*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6) &&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*issez*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z) )
+                {
+                if (text.length() >= 6 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-6)&&
+                    !string_util::is_one_of(text[text.length()-6], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-5);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*îmes*/common_lang_constants::LOWER_I_CIRCUMFLEX, common_lang_constants::UPPER_I_CIRCUMFLEX, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*îtes*/common_lang_constants::LOWER_I_CIRCUMFLEX, common_lang_constants::UPPER_I_CIRCUMFLEX, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irai*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*iras*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*irez*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*isse*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                    !string_util::is_one_of(text[text.length()-5], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-4);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ies*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 4 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-4) &&
+                    !string_util::is_one_of(text[text.length()-4], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-3);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ira*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (text.length() >= 4 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-4) &&
+                    !string_util::is_one_of(text[text.length()-4], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-3);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text, common_lang_constants::LOWER_I_CIRCUMFLEX, common_lang_constants::UPPER_I_CIRCUMFLEX, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= text.length()-3 &&
+                    !string_util::is_one_of(text[text.length()-3], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-2);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ie*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= text.length()-3 &&
+                    !string_util::is_one_of(text[text.length()-3], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-2);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ir*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= text.length()-3 &&
+                    !string_util::is_one_of(text[text.length()-3], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-2);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*is*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-3) &&
+                    !string_util::is_one_of(text[text.length()-3], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-2);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*it*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-3) &&
+                    !string_util::is_one_of(text[text.length()-3], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-2);
+                    return;
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (text.length() >= 2 &&
+                    stem<string_typeT>::get_rv() <= (text.length()-2) &&
+                    !string_util::is_one_of(text[text.length()-2], FRENCH_VOWELS) )
+                    {
+                    text.erase(text.length()-1);
+                    return;
+                    }
+                }
+            //only called if 2a fails to remove a suffix
+            step_2b(text);
+            }
+        //---------------------------------------------
+        void step_2b(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*assions*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assent*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assiez*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (text.length() >= 7 &&
+                stem<string_typeT>::get_rv() <= (text.length()-7) &&
+                (text[text.length()-7] == common_lang_constants::LOWER_E || text[text.length()-7] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-6] == common_lang_constants::LOWER_R || text[text.length()-6] == common_lang_constants::UPPER_R) &&
+                (text[text.length()-5] == common_lang_constants::LOWER_A || text[text.length()-5] == common_lang_constants::UPPER_A) &&
+                (text[text.length()-3] == common_lang_constants::LOWER_E || text[text.length()-3] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_N || text[text.length()-2] == common_lang_constants::UPPER_N) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_T || text[text.length()-1] == common_lang_constants::UPPER_T) &&
+                is_either<wchar_t>(text[text.length()-4], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                text.erase(text.length()-7);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erions*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (text.length() >= 5 &&
+                stem<string_typeT>::get_rv() <= (text.length()-5) &&
+                (text[text.length()-5] == common_lang_constants::LOWER_A || text[text.length()-5] == common_lang_constants::UPPER_A) &&
+                (text[text.length()-3] == common_lang_constants::LOWER_E || text[text.length()-3] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_N || text[text.length()-2] == common_lang_constants::UPPER_N) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_T || text[text.length()-1] == common_lang_constants::UPPER_T) &&
+                is_either<wchar_t>(text[text.length()-4], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                text.erase(text.length()-5);
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*antes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asses*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*èrent*/common_lang_constants::LOWER_E_GRAVE, common_lang_constants::UPPER_E_GRAVE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erais*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erait*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eriez*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erons*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eront*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*ions*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ions*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*âmes*/common_lang_constants::LOWER_A_CIRCUMFLEX, common_lang_constants::UPPER_A_CIRCUMFLEX, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*âtes*/common_lang_constants::LOWER_A_CIRCUMFLEX, common_lang_constants::UPPER_A_CIRCUMFLEX, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ants*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asse*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erai*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eras*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erez*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ais*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ait*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ant*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ées*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*era*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iez*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ât*/common_lang_constants::LOWER_A_CIRCUMFLEX, common_lang_constants::UPPER_A_CIRCUMFLEX, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ai*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*as*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ée*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*és*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ez*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*é*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text)
+            {
+            if (text.length() == 0)
+                { return; }
+            if (text[text.length()-1] == LOWER_Y_HASH)
+                {
+                text[text.length()-1] = common_lang_constants::LOWER_I;
+                }
+            else if (text[text.length()-1] == UPPER_Y_HASH)
+                {
+                text[text.length()-1] = common_lang_constants::UPPER_I;
+                }
+            else if (text[text.length()-1] == common_lang_constants::UPPER_C_CEDILLA)
+                {
+                text[text.length()-1] = common_lang_constants::UPPER_C;
+                }
+            else if (text[text.length()-1] == common_lang_constants::LOWER_C_CEDILLA)
+                {
+                text[text.length()-1] = common_lang_constants::LOWER_C;
+                }
+            }
+        //---------------------------------------------
+        void step_4(string_typeT& text)
+            {
+            if (text.length() >= 2 &&
+                (text[text.length()-1] == common_lang_constants::LOWER_S || text[text.length()-1] == common_lang_constants::UPPER_S) &&
+                !string_util::is_one_of(text[text.length()-2], FRENCH_AIOUES) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+
+            if (stem<string_typeT>::is_suffix_in_rv(text,/*ière*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E_GRAVE, common_lang_constants::UPPER_E_GRAVE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                text.replace(text.end()-4, text.end(), L"i");
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (text.length() >= 4 &&
+                stem<string_typeT>::get_rv() <= (text.length()-4) &&
+                (text[text.length()-3] == common_lang_constants::LOWER_E_GRAVE || text[text.length()-3] == common_lang_constants::UPPER_E_GRAVE) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_R || text[text.length()-2] == common_lang_constants::UPPER_R) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_E || text[text.length()-1] == common_lang_constants::UPPER_E) &&
+                is_either<wchar_t>(text[text.length()-4], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                text.replace(text.end()-4, text.end(), L"i");
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ier*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                text.replace(text.end()-3, text.end(), L"i");
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (text.length() >= 3 &&
+                stem<string_typeT>::get_rv() <= (text.length()-3) &&
+                (text[text.length()-2] == common_lang_constants::LOWER_E || text[text.length()-2] == common_lang_constants::UPPER_E) &&
+                (text[text.length()-1] == common_lang_constants::LOWER_R || text[text.length()-1] == common_lang_constants::UPPER_R) &&
+                is_either<wchar_t>(text[text.length()-3], LOWER_I_HASH, UPPER_I_HASH) )
+                {
+                text.replace(text.end()-3, text.end(), L"i");
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*sion*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix_in_rv(text,/*tion*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_r2() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ë*/common_lang_constants::LOWER_E_UMLAUTS, common_lang_constants::UPPER_E_UMLAUTS) )
+                {
+                if (text.length() >= 3 &&
+                    (is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) &&
+                    is_either<wchar_t>(text[text.length()-2], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) ) )
+                    {
+                    text.erase(text.length()-1);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_5(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*enn*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix(text,/*onn*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                stem<string_typeT>::is_suffix(text,/*ett*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                stem<string_typeT>::is_suffix(text,/*ell*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                stem<string_typeT>::is_suffix(text,/*eill*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_6(string_typeT& text)
+            {
+            size_t last_vowel = text.find_last_of(FRENCH_VOWELS);
+            if (last_vowel == string_typeT::npos ||
+                last_vowel == text.length()-1)
+                {
+                return;
+                }
+            else if (is_either<wchar_t>(text[last_vowel], 0xE9, 0xE8) ||
+                    is_either<wchar_t>(text[last_vowel], 0xC9, 0xC8) )
+                {
+                text[last_vowel] = common_lang_constants::LOWER_E;
+                }
+            }
+
+        //internal data specific to French stemmer
+        bool m_step_1_successful;
+        };
+    }
+
+#endif //__FRENCH_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/german_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/german_stem.h
new file mode 100644 (file)
index 0000000..c494f7c
--- /dev/null
@@ -0,0 +1,278 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __GERMAN_STEM_H__
+#define __GERMAN_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class german_stem
+        German stemming class.
+
+    German includes the following accented forms,
+    -ä ö ü and a special letter, ß, equivalent to double s.
+
+    The following letters are vowels:
+    -a e i o u y ä ö ü
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes:
+        - e em en ern er es
+        - s (preceded by a valid s-ending)
+    and delete if in R1. (Of course the letter of the valid s-ending is not necessarily in R1).
+
+    (For example, äckern -> äck, ackers -> acker, armes -> arm).
+
+    <b>Step 2:</b>
+
+    Search for the longest among the following suffixes:
+        - en er est
+        - st (preceded by a valid st-ending, itself preceded by at least 3 letters)
+    and delete if in R1.
+
+    (For example, derbsten -> derbst by step 1, and derbst -> derb by step 2,
+    because b is a valid st-ending, and is preceded by just 3 letters).
+
+    <b>Step 3:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated.
+        - end ung
+            - Delete if in R2
+            - If preceded by ig, delete if in R2 and not preceded by e
+
+        - ig ik isch
+            - Delete if in R2 and not preceded by e
+
+        - lich heit
+            - Delete if in R2
+            - If preceded by er or en, delete if in R1
+
+        - keit
+            - Delete if in R2
+            - If preceded by lich or ig, delete if in R2
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class german_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param text string to stem.
+           @param contract_transliterated_umlauts use variant algorithm.
+           that expands "ä" to "ae", ect...*/
+        void operator()(string_typeT& text,
+                        bool contract_transliterated_umlauts = false)
+            {
+            if (text.length() < 2)
+                {
+                stem<string_typeT>::remove_german_umlauts(text);
+                return;
+                }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            stem<string_typeT>::hash_german_yu(text, GERMAN_VOWELS);
+            //change 'ß' to "ss"
+            string_util::replace_all<string_typeT>(text, string_typeT(1, common_lang_constants::ESZETT), L"ss");
+            //German variant addition
+            if (contract_transliterated_umlauts)
+                {
+                string_util::replace_all<string_typeT>(text, L"ae", string_typeT(1, common_lang_constants::LOWER_A_UMLAUTS));
+                string_util::replace_all<string_typeT>(text, L"oe", string_typeT(1, common_lang_constants::LOWER_O_UMLAUTS));
+                //ue to ü, if not in front of 'q'
+                size_t start = 1;
+                while (start != string_typeT::npos)
+                    {
+                    start = text.find(L"ue", start);
+                    if (start == string_typeT::npos ||
+                        is_either<wchar_t>(text[start-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                        {
+                        break;
+                        }
+                    text.replace(start, 2, string_typeT(1, common_lang_constants::LOWER_U_UMLAUTS));
+                    }
+                }
+
+            stem<string_typeT>::find_r1(text, GERMAN_VOWELS);
+            if (stem<string_typeT>::get_r1() == text.length() )
+                {
+                stem<string_typeT>::remove_german_umlauts(text);
+                stem<string_typeT>::unhash_german_yu(text);
+                return;
+                }
+            stem<string_typeT>::find_r2(text, GERMAN_VOWELS);
+            //R1 must have at least 3 characters in front of it
+            if (stem<string_typeT>::get_r1() < 3)
+                {
+                stem<string_typeT>::set_r1(3);    
+                }
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+
+            //unhash special 'u' and 'y' back, and remove the umlaut accent from a, o and u. 
+            stem<string_typeT>::remove_german_umlauts(text);
+            stem<string_typeT>::unhash_german_yu(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*ern*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*em*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                return;
+                }
+            ///Define a valid s-ending as one of b, d, f, g, h, k, l, m, n, r or t.
+            else if (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (string_util::is_one_of(text[text.length()-2], L"bdfghklmnrtBDFGHKLMNRT") )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*est*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                return;
+                }
+            ///Define a valid st-ending as the same list, excluding letter r.
+            else if (text.length() >= 6 &&
+                    stem<string_typeT>::is_suffix_in_r1(text,/*st*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (string_util::is_one_of(text[text.length()-3], L"bdfghklmntBDFGHKLMNT") )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text) 
+            {
+            if (stem<string_typeT>::delete_if_is_in_r2(text,/*heit*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*lich*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ||
+                    stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                    {
+                    return;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*keit*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*lich*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                    {
+                    return;
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*isch*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) )
+                {
+                if (text.length() >= 5 &&
+                    stem<string_typeT>::get_r2() <= (text.length()-4) &&
+                    is_neither<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*end*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::is_suffix_in_r2(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G)  &&
+                    is_neither<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ung*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::is_suffix_in_r2(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G)  &&
+                    is_neither<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_r2() <= text.length()-2 &&
+                    is_neither<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ik*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_r2() <= text.length()-2 &&
+                    is_neither<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        };
+    }
+
+#endif //__GERMAN_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/italian_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/italian_stem.h
new file mode 100644 (file)
index 0000000..5cfa118
--- /dev/null
@@ -0,0 +1,900 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __ITALIAN_STEM_H__
+#define __ITALIAN_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class italian_stem
+        Italian stemming class.
+
+    Italian can include the following accented forms:
+        - á é í ó ú à è ì ò ù
+
+    First, replace all acute accents by grave accents.
+    And, as in French, put u after q, and u, i between vowels into upper case. The vowels are then:
+        - a e i o u à è ì ò ù
+
+    R2 and RV have the same definition as in the Spanish stemmer.
+
+    \par Algorithm:
+
+    <b>Step 0:</b>
+
+    Search for the longest among the following suffixes
+        - ci gli la le li lo mi ne si ti vi sene gliela gliele glieli glielo gliene mela
+        mele meli melo mene tela tele teli telo tene cela cele celi celo cene vela vele veli velo vene 
+
+    following one of:
+        - ando endo
+        - ar er ir 
+
+    in RV. In case of (a) the suffix is deleted, in case (b) it is replace by e
+    (guardandogli -> guardando, accomodarci -> accomodare).
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated.
+        - anza   anze   ico   ici   ica   ice   iche   ichi   ismo   ismi   abile   abili   ibile
+         ibili   ista   iste   isti   istà   istè   istì   oso   osi   osa   ose   mente   atrice
+         atrici  ante   anti
+            - Delete if in R2.
+        - azione   azioni   atore   atori delete if in R2
+            - If preceded by ic, delete if in R2.
+        - logia   logie
+            - Replace with log if in R2.
+        - uzione   uzioni   usione   usioni
+            - Replace with u if in R2.
+        - enza   enze
+            - Replace with ente if in R2.
+        - amento   amenti   imento   imenti
+            - Delete if in RV.
+        - amente
+            - Delete if in R1.
+            - If preceded by iv, delete if in R2 (and if further preceded by at, delete if in R2), otherwise,
+            - If preceded by os, ic or abil, delete if in R2.
+        - ità
+            - Delete if in R2.
+            - If preceded by abil, ic or iv, delete if in R2.
+        - ivo   ivi   iva   ive
+            - Delete if in R2.
+            - If preceded by at, delete if in R2 (and if further preceded by ic, delete if in R2).
+
+    Do step 2 if no ending was removed by step 1.
+
+    <b>Step 2:</b>
+    Search for the longest among the following suffixes in RV, and if found, delete.
+        - ammo ando ano are arono asse assero assi assimo ata ate ati ato
+        ava avamo avano avate avi avo emmo enda ende endi endo erà erai
+        eranno ere erebbe erebbero erei eremmo eremo ereste eresti erete
+        erò erono essero ete eva evamo evano evate evi evo Yamo iamo immo 
+        irà irai iranno ire irebbe irebbero irei iremmo iremo ireste iresti
+        irete irò irono isca iscano isce isci isco iscono issero ita ite iti
+        ito iva ivamo ivano ivate ivi ivo ono uta ute uti uto ar ir
+
+    Always do steps 3a and 3b.
+
+    <b>Step 3(a):</b>
+
+    Delete a final a, e, i, o, à, è, ì, or ò if it is in RV, and a preceding 'i'
+    if it is in RV (crocchi -> crocch, crocchio -> crocch).
+
+    <b>Step 3(b):</b>
+
+    Replace final ch (or gh) with c (or g) if in RV (crocch -> crocc).
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class italian_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        ///@param text string to stem
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                stem<string_typeT>::italian_acutes_to_graves(text);
+                return;
+                }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+            stem<string_typeT>::italian_acutes_to_graves(text);
+            stem<string_typeT>::hash_italian_ui(text, ITALIAN_VOWELS);
+
+            stem<string_typeT>::find_r1(text, ITALIAN_VOWELS);
+            stem<string_typeT>::find_r2(text, ITALIAN_VOWELS);
+            stem<string_typeT>::find_spanish_rv(text, ITALIAN_VOWELS);
+
+            //step 0:
+            step_0(text);
+            //step 1:
+            size_t text_length = text.length();
+            step_1(text);
+
+            //step 2 is called only if step 1 did not remove a suffix
+            if (text_length == text.length() )
+                {
+                step_2(text);
+                }
+
+            //step 3:
+            step_3a(text);
+            step_3b(text);
+
+            stem<string_typeT>::unhash_italian_ui(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_0(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix(text,/*gliela*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 6) || step_0b(text, 6) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*gliele*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 6) || step_0b(text, 6) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*glieli*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 6) || step_0b(text, 6) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*glielo*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 6) || step_0b(text, 6) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*gliene*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 6) || step_0b(text, 6) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*sene*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*mela*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*mele*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*meli*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*melo*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*mene*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*tela*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*tele*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*teli*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*telo*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*tene*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*cela*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*cela*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*celi*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*celo*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*cene*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*vela*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*vele*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*veli*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*velo*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*vene*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 4) || step_0b(text, 4) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*gli*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 3) || step_0b(text, 3) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ci*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*la*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*le*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*li*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*lo*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*mi*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ne*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*si*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*ti*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*vi*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                if (step_0a(text, 2) || step_0b(text, 2) ) { /*NOOP*/ }
+                return;
+                }
+            }
+        //---------------------------------------------
+        bool step_0a(string_typeT& text, size_t suffix_length)
+            {
+            if (text.length() >= (suffix_length+4) &&
+                stem<string_typeT>::get_rv() <= text.length()-(4+suffix_length) &&
+                (/*ando*/(is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                        is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                        is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                        is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) ||
+                /*endo*/(is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                        is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                        is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                        is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            return false;
+            }
+        //---------------------------------------------
+        bool step_0b(string_typeT& text, size_t suffix_length)
+            {
+            if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                (
+                /*ar*/(is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) && is_either<wchar_t>(text[text.length()-1-suffix_length], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) ||
+                /*er*/(is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) && is_either<wchar_t>(text[text.length()-1-suffix_length], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) ||
+                /*or*/(is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) && is_either<wchar_t>(text[text.length()-1-suffix_length], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                ) )
+                {
+                text.replace(text.end()-suffix_length, text.end(), L"e");
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            return false;
+            }
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*amento*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ||
+                stem<string_typeT>::delete_if_is_in_rv(text,/*amenti*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                stem<string_typeT>::delete_if_is_in_rv(text,/*imento*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ||
+                stem<string_typeT>::delete_if_is_in_rv(text,/*imenti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*azione*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*azioni*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*uzione*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                stem<string_typeT>::is_suffix_in_r2(text,/*uzioni*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                stem<string_typeT>::is_suffix_in_r2(text,/*usione*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                stem<string_typeT>::is_suffix_in_r2(text,/*usioni*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                text.erase(text.length()-5);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*amente*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    }
+                else if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*os*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                    { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*atrice*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*atrici*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*abile*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*abili*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ibile*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ibili*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*mente*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*atore*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*atori*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*logia*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                stem<string_typeT>::is_suffix_in_r2(text,/*logie*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*enza*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                stem<string_typeT>::is_suffix_in_r2(text,/*enze*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                text.replace(text.end()-2, text.end(), L"te");
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*anti*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*anza*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*anze*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iche*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ichi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ismo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ismi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ista*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iste*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*isti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*istà*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_GRAVE, common_lang_constants::UPPER_A_GRAVE) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*istè*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E_GRAVE, common_lang_constants::UPPER_E_GRAVE) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*istì*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I_GRAVE, common_lang_constants::UPPER_I_GRAVE) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ico*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ici*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ica*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ice*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*oso*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osi*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osa*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ose*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ità*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A_GRAVE, common_lang_constants::UPPER_A_GRAVE) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                    { /*NOOP*/ }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ivi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*iva*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                stem<string_typeT>::delete_if_is_in_r2(text,/*ive*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*erebbero*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irebbero*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assero*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assimo*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eranno*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erebbe*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eremmo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ereste*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eresti*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*essero*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iranno*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irebbe*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iremmo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ireste*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iresti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iscano*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iscono*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*issero*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arono*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avamo*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avano*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avate*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eremo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erete*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erono*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*evamo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*evano*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*evate*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iremo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irete*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irono*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ivamo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ivano*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ivate*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ammo*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ando*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, /*asse*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assi*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*emmo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*enda*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ende*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*endi*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*endo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erai*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erei*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*yamo*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iamo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*immo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irai*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irei*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isca*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isce*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isci*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isco*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ano*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*are*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ata*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ate*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ati*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ato*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ava*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avi*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avo*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erà*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_GRAVE, common_lang_constants::UPPER_A_GRAVE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ere*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erò*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O_GRAVE, common_lang_constants::UPPER_O_GRAVE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ete*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eva*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*evi*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*evo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irà*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_GRAVE, common_lang_constants::UPPER_A_GRAVE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ire*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irò*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O_GRAVE, common_lang_constants::UPPER_O_GRAVE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ita*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ite*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iti*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ito*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iva*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ivi*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ivo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ono*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*uta*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ute*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*uti*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*uto*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ar*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            ///'ir' not in original specification, but used in general implementation
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ir*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            /**deletion or 'er' from rv is considered problematic,
+            but part of the standard*/
+            }
+        //---------------------------------------------
+        void step_3a(string_typeT& text)
+            {
+            if (text.length() >= 1 &&
+                stem<string_typeT>::get_rv() <= text.length()-1 &&
+                string_util::is_one_of(text[text.length()-1], ITALIAN_VOWELS_SIMPLE) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                if (stem<string_typeT>::get_rv() <= text.length()-1 &&                    
+                    is_either<wchar_t>(text[text.length()-1], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            }
+        //---------------------------------------------
+        void step_3b(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_rv(text,/*ch*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) ||
+                stem<string_typeT>::is_suffix_in_rv(text,/*gh*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_H, common_lang_constants::UPPER_H) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        };
+    }
+
+#endif //__ITALIAN_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/norwegian_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/norwegian_stem.h
new file mode 100644 (file)
index 0000000..903efda
--- /dev/null
@@ -0,0 +1,306 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __NORWEGIAN_STEM_H__
+#define __NORWEGIAN_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class norwegian_stem
+        Norwegian stemming class.
+
+    The Norwegian alphabet includes the following additional letters:
+        - æ   å   ø
+
+    The following letters are vowels:
+        - a   e   i   o   u   y   æ   å   ø
+
+    R2 is not used: R1 is defined in the same way as in the German stemmer.
+
+    Define a valid s-ending as one of
+        - b   c   d   f   g   h   j   l   m   n   o   p   r   t   v   y   z,
+        - or 'k', not preceded by a vowel.
+    
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated: 
+        - a e ede ande ende ane ene hetene en heten ar er heter as es edes
+          endes enes hetenes ens hetens ers ets et het ast 
+            - Delete.
+        - s 
+            - Delete if preceded by a valid s-ending.
+
+        - erte   ert 
+            - Replace with "er".
+
+        (Of course the letter of the valid s-ending is not necessarily in R1).
+
+    <b>Step 2:</b>
+
+    If the word ends dt or vt in R1, then delete the 't'.
+    (For example, meldt -> meld, operativt -> operativ).
+
+    <b>Step 3:</b>
+
+    Search for the longest among the following suffixes in R1, and if found, delete:
+        - leg eleg ig eig lig elig els lov elov slov hetslov
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class norwegian_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                return;
+                }
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::find_r1(text, NORWEGIAN_VOWELS);
+            if (stem<string_typeT>::get_r1() == text.length() )
+                {
+                return;
+                }
+            //R1 must have at least 3 characters in front of it
+            if (stem<string_typeT>::get_r1() < 3)
+                {
+                stem<string_typeT>::set_r1(3);
+                }
+            //norwegian does not use R2
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*hetenes*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*hetene*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*hetens*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heter*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heten*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*endes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ande*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ende*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*edes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*enes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*erte*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ers*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ets*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*het*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ast*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ens*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ene*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ane*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ede*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*ert*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*et*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*as*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ar*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_r1() <= text.length()-1)
+                    {
+                    //only delete if a valid "s" ending
+                    if (text.length() >= 2 &&
+                        string_util::is_one_of(text[text.length()-2],
+                        L"bcdfghjlmnoprtvyzBCDFGHJLMNOPRTVYZ") )
+                        {
+                        text.erase(text.length()-1);
+                        stem<string_typeT>::update_r_sections(text);
+                        return;
+                        }
+                    else if (text.length() >= 3 &&
+                        is_either<wchar_t>(text[text.length()-2], common_lang_constants::LOWER_K, common_lang_constants::UPPER_K) &&
+                        !string_util::is_one_of(text[text.length()-3], NORWEGIAN_VOWELS))
+                        {
+                        text.erase(text.length()-1);
+                        stem<string_typeT>::update_r_sections(text);
+                        return;
+                        }
+                    }
+                }
+            }
+
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*dt*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*vt*/common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*hetslov*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*slov*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*elov*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*elig*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*eleg*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*lov*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*els*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*lig*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*eig*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*leg*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            }
+        };
+    }
+
+#endif //__NORWEGIAN_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/portuguese_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/portuguese_stem.h
new file mode 100644 (file)
index 0000000..bb11fdd
--- /dev/null
@@ -0,0 +1,1014 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __PORTUGUESE_STEM_H__
+#define __PORTUGUESE_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class portuguese_stem
+        Portuguese stemming class.
+
+    Letters in Portuguese include the following accented forms,
+        - á é í ó ú â ê ô ç ã õ ü ñ
+
+    The following letters are vowels:
+        - a e i o u á é í ó ú â ê ô
+
+    And the two nasalised vowel forms
+     - ã õ
+
+    should be treated as a vowel followed by a consonant. 
+
+    ã and õ are therefore replaced by a~ and o~ in the word, where ~ is a separate character to be treated as a consonant.
+    And then R2 and RV have the same definition as in the Spanish stemmer.
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated.
+        - eza   ezas   ico   ica   icos   icas   ismo   ismos   ável   ível   ista   istas
+         oso   osa   osos   osas   amento   amentos   imento   imentos   adora   ador   aça~o
+         adoras   adores   aço~es   ante   antes   ância
+            - Delete if in R2.
+        - logía logías
+            - Replace with log if in R2.
+        -ución uciones
+            - Replace with u if in R2
+        - ência ências
+            - Replace with ente if in R2.
+        - amente
+            - Delete if in R1.
+            - If preceded by iv, delete if in R2 (and if further preceded by at, delete if in R2), otherwise,
+            - If preceded by os, ic or ad, delete if in R2.
+        -mente
+            - Delete if in R2.
+            - If preceded by ante, avel or ível, delete if in R2.
+        - idade idades
+            - Delete if in R2.
+            - If preceded by abil, ic or iv, delete if in R2.
+        - iva ivo ivas ivos
+            - Delete if in R2.
+            - If preceded by at, delete if in R2.
+        - ira iras
+            - Replace with ir if in RV and preceded by e.
+
+    Do step 2 if no ending was removed by step 1.
+
+    <b>Step 2:</b>
+
+    Search for the longest among the following suffixes in RV, and if found, delete. 
+
+        - ada ida ia aria eria iria ará ara erá era irá ava asse esse isse aste este iste
+        ei arei erei irei am iam ariam eriam iriam aram eram iram avam em arem erem irem
+        assem essem issem ado ido ando endo indo ara~o era~o ira~o ar er ir as adas idas
+        ias arias erias irias arás aras erás eras irás avas es ardes erdes irdes ares eres
+        ires asses esses isses astes estes istes is ais eis íeis aríeis eríeis iríeis áreis
+        areis éreis ereis íreis ireis ásseis ésseis ísseis áveis ados idos ámos amos íamos
+        aríamos eríamos iríamos áramos éramos íramos ávamos emos aremos eremos iremos ássemos
+        êssemos íssemos imos armos ermos irmos eu iu ou ira iras
+
+    If the last step to be obeyed - either step 1 or 2 - altered the word, do step 3.
+
+    <b>Step 3:</b>
+
+    Delete suffix 'i' if in RV and preceded by 'c'.
+    Alternatively, if neither steps 1 nor 2 altered the word, do step 4.
+
+    <b>Step 4:</b>
+    
+    If the word ends with one of the suffixes 
+        - os a i o á í ó 
+
+    in RV, delete it.
+
+    Always do step 5.
+
+    <b>Step 5:</b>
+    
+    If the word ends with one of
+        - e é ê 
+
+    in RV, delete it, and if preceded by gu (or ci) with the u (or i) in RV, delete the u (or i). 
+    Or if the word ends ç remove the cedilla.
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class portuguese_stem : public stem<string_typeT>
+        {
+    public:
+        portuguese_stem() : m_step1_step2_altered(false), m_altered_suffix_index(0)
+            {}
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                return;
+                }
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //reset internal data
+            m_altered_suffix_index = 0;
+            m_step1_step2_altered = false;
+            stem<string_typeT>::reset_r_values();
+
+            string_util::replace_all<string_typeT>(text, string_typeT(1, common_lang_constants::LOWER_A_TILDE), L"a~");
+            string_util::replace_all<string_typeT>(text, string_typeT(1, common_lang_constants::UPPER_A_TILDE), L"A~");
+            string_util::replace_all<string_typeT>(text, string_typeT(1, common_lang_constants::LOWER_O_TILDE), L"o~");
+            string_util::replace_all<string_typeT>(text, string_typeT(1, common_lang_constants::UPPER_O_TILDE), L"O~");
+
+            stem<string_typeT>::find_r1(text, PORTUGUESE_VOWELS);
+            stem<string_typeT>::find_r2(text, PORTUGUESE_VOWELS);
+            stem<string_typeT>::find_spanish_rv(text, PORTUGUESE_VOWELS);
+
+            step_1(text);
+            //intermediate steps handled by step 1
+            if (!m_step1_step2_altered)
+                {
+                step_4(text);
+                }
+            step_5(text);
+
+            //Turn a~, o~ back into ã, õ
+            string_util::replace_all<string_typeT>(text, L"a~", string_typeT(1, common_lang_constants::LOWER_A_TILDE));
+            string_util::replace_all<string_typeT>(text, L"A~", string_typeT(1, common_lang_constants::UPPER_A_TILDE));
+            string_util::replace_all<string_typeT>(text, L"o~", string_typeT(1, common_lang_constants::LOWER_O_TILDE));
+            string_util::replace_all<string_typeT>(text, L"O~", string_typeT(1, common_lang_constants::UPPER_O_TILDE));
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            size_t original_length = text.length();
+            if (stem<string_typeT>::is_suffix_in_r2(text,/*uciones*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-6);
+                m_altered_suffix_index = text.length()-1;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*amentos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*imentos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*amento*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*imento*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*adoras*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*adores*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*aço~es*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_C_CEDILLA, common_lang_constants::UPPER_C_CEDILLA, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::TILDE, common_lang_constants::TILDE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*ências*/common_lang_constants::LOWER_E_CIRCUMFLEX, common_lang_constants::UPPER_E_CIRCUMFLEX, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.replace(text.end()-6, text.end(), L"ente");
+                m_altered_suffix_index = text.length()-4;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*logías*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-3);
+                m_altered_suffix_index = text.length()-3;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*amente*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, false) )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false);
+                    }
+                else
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r2(text,/*os*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ad*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                        {
+                        //NOOP (fall through to branching statement)
+                        }
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*idades*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }    
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*logía*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                text.erase(text.length()-2);
+                m_altered_suffix_index = text.length()-3;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }    
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*ución*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                text.erase(text.length()-4);
+                m_altered_suffix_index = text.length()-1;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*ência*/common_lang_constants::LOWER_E_CIRCUMFLEX, common_lang_constants::UPPER_E_CIRCUMFLEX, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                text.replace(text.end()-5, text.end(), L"ente");
+                m_altered_suffix_index = text.length()-4;
+                stem<string_typeT>::update_r_sections(text);
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*mente*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*avel*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ível*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*idade*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*eiras*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::get_rv() <= text.length()-4)
+                    {
+                    text.erase(text.length()-2);
+                    m_altered_suffix_index = text.length()-3;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*antes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ância*/common_lang_constants::LOWER_A_CIRCUMFLEX, common_lang_constants::UPPER_A_CIRCUMFLEX, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ismos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*istas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*adora*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*aça~o*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_C_CEDILLA, common_lang_constants::UPPER_C_CEDILLA, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::TILDE, common_lang_constants::TILDE, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ezas*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*icos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*icas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ismo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ável*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ível*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ista*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osos*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osas*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ador*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::is_suffix(text,/*eira*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (stem<string_typeT>::get_rv() <= text.length()-3)
+                    {
+                    text.erase(text.length()-1);
+                    m_altered_suffix_index = text.length()-3;
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*iva*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                    {
+                    //NOOP (fall through to branching statement)
+                    }
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*eza*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ico*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ica*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*oso*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osa*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            //branch to the next appropriate step
+            if (original_length == text.length() )
+                {
+                step_2(text);
+                }
+            else
+                {
+                m_step1_step2_altered = true;
+                step_3(text);
+                }
+             }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            size_t original_length = text.length();
+
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*aríamos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eríamos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iríamos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ássemos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*êssemos*/common_lang_constants::LOWER_E_CIRCUMFLEX, common_lang_constants::UPPER_E_CIRCUMFLEX, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íssemos*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aríeis*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eríeis*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iríeis*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ásseis*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ésseis*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ísseis*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*áramos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*éramos*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íramos*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ávamos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aremos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eremos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iremos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S ,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ariam*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eriam*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iriam*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*assem*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*essem*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*issem*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ara~o*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::TILDE, common_lang_constants::TILDE, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*era~o*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::TILDE, common_lang_constants::TILDE, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ira~o*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::TILDE, common_lang_constants::TILDE, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arias*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erias*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irias*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ardes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erdes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irdes*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asses*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*esses*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isses*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*astes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*estes*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*istes*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*áreis*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*areis*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*éreis*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ereis*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íreis*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ireis*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*áveis*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íamos*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*armos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ermos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irmos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S,false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aria*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eria*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iria*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asse*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*esse*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isse*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aste*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*este*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iste*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arei*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erei*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irei*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aram*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eram*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iram*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avam*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arem*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erem*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irem*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ando*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*endo*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*indo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*adas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*idas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arás*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aras*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erás*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eras*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irás*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*avas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ares*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eres*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ires*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íeis*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ados*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*idos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ámos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*amos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*emos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*imos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iras*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ada*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ida*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ará*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ara*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erá*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*era*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irá*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ava*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iam*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ado*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ido*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ias*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ais*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eis*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ira*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ia*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ei*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*am*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*em*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ar*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ir*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*as*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*is*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eu*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iu*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ou*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, false) )
+                {
+                //NOOP (fall through to branching statement)
+                }
+
+            if (original_length != text.length() )
+                {
+                m_step1_step2_altered = true;
+                step_3(text);
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text) 
+            {
+            if (stem<string_typeT>::is_suffix(text,/*ci*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                stem<string_typeT>::get_rv() <= text.length()-1)
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_4(string_typeT& text) 
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*os*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE) )
+                {
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_5(string_typeT& text) 
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                if (text.length() >= 1 &&
+                    stem<string_typeT>::get_rv() <= text.length()-1 &&
+                    (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) ||
+                    stem<string_typeT>::is_suffix(text,/*ci*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I)) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*é*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                if (text.length() >= 1 &&
+                    stem<string_typeT>::get_rv() <= text.length()-1 &&
+                    (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) ||
+                    stem<string_typeT>::is_suffix(text,/*ci*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I)) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ê*/common_lang_constants::LOWER_E_CIRCUMFLEX, common_lang_constants::UPPER_E_CIRCUMFLEX, false) )
+                {
+                if (text.length() >= 1 &&
+                    stem<string_typeT>::get_rv() <= text.length()-1 &&
+                    (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) ||
+                    stem<string_typeT>::is_suffix(text,/*ci*/common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I)) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (text.length() >= 1 &&
+                text[text.length()-1] == common_lang_constants::UPPER_C_CEDILLA)
+                {
+                text[text.length()-1] = common_lang_constants::UPPER_C;
+                }
+            else if (text.length() >= 1 &&
+                text[text.length()-1] == common_lang_constants::LOWER_C_CEDILLA)
+                {
+                text[text.length()-1] = common_lang_constants::LOWER_C;
+                }
+            }
+        //internal data specific to Portuguese stemmer
+        bool m_step1_step2_altered;
+        size_t m_altered_suffix_index;
+        };
+    }
+
+#endif //__PORTUGUESE_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/russian_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/russian_stem.h
new file mode 100644 (file)
index 0000000..4d1625f
--- /dev/null
@@ -0,0 +1,538 @@
+/**
+\date 2010-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __RUSSIAN_STEM_H__
+#define __RUSSIAN_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    static const wchar_t RUSSIAN_VOWELS[] = { 0x0410, 0x0430, 0x0415, 0x0435, 0x0418, 0x0438,
+                                              0x041E, 0x043E, 0x423, 0x0443, 0x042B, 0x044B,
+                                              0x042D, 0x044D, 0x042E, 0x044E, 0x042F, 0x044F, 0 };
+
+    static const wchar_t RUSSIAN_A_UPPER = 0x0410;
+    static const wchar_t RUSSIAN_A_LOWER = 0x0430;
+
+    static const wchar_t RUSSIAN_BE_UPPER = 0x0411;
+    static const wchar_t RUSSIAN_BE_LOWER = 0x0431;
+
+    static const wchar_t RUSSIAN_VE_UPPER = 0x0412;
+    static const wchar_t RUSSIAN_VE_LOWER = 0x0432;
+
+    static const wchar_t RUSSIAN_GHE_UPPER = 0x0413;
+    static const wchar_t RUSSIAN_GHE_LOWER = 0x0433;
+
+    static const wchar_t RUSSIAN_DE_UPPER = 0x0414;
+    static const wchar_t RUSSIAN_DE_LOWER = 0x0434;
+
+    static const wchar_t RUSSIAN_IE_UPPER = 0x0415;
+    static const wchar_t RUSSIAN_IE_LOWER = 0x0435;
+
+    static const wchar_t RUSSIAN_ZHE_UPPER = 0x0416;
+    static const wchar_t RUSSIAN_ZHE_LOWER = 0x0436;
+
+    static const wchar_t RUSSIAN_ZE_UPPER = 0x0417;
+    static const wchar_t RUSSIAN_ZE_LOWER = 0x0437;
+
+    static const wchar_t RUSSIAN_I_UPPER = 0x0418;
+    static const wchar_t RUSSIAN_I_LOWER = 0x0438;
+
+    static const wchar_t RUSSIAN_SHORT_I_UPPER = 0x0419;
+    static const wchar_t RUSSIAN_SHORT_I_LOWER = 0x0439;
+
+    static const wchar_t RUSSIAN_KA_UPPER = 0x041A;
+    static const wchar_t RUSSIAN_KA_LOWER = 0x043A;
+
+    static const wchar_t RUSSIAN_EL_UPPER = 0x041B;
+    static const wchar_t RUSSIAN_EL_LOWER = 0x043B;
+
+    static const wchar_t RUSSIAN_EM_UPPER = 0x041C;
+    static const wchar_t RUSSIAN_EM_LOWER = 0x043C;
+
+    static const wchar_t RUSSIAN_EN_UPPER = 0x041D;
+    static const wchar_t RUSSIAN_EN_LOWER = 0x043D;
+
+    static const wchar_t RUSSIAN_O_UPPER = 0x041E;
+    static const wchar_t RUSSIAN_O_LOWER = 0x043E;
+
+    static const wchar_t RUSSIAN_PE_UPPER = 0x041F;
+    static const wchar_t RUSSIAN_PE_LOWER = 0x043F;
+
+    static const wchar_t RUSSIAN_ER_UPPER = 0x0420;
+    static const wchar_t RUSSIAN_ER_LOWER = 0x0440;
+
+    static const wchar_t RUSSIAN_ES_UPPER = 0x0421;
+    static const wchar_t RUSSIAN_ES_LOWER = 0x0441;
+
+    static const wchar_t RUSSIAN_TE_UPPER = 0x0422;
+    static const wchar_t RUSSIAN_TE_LOWER = 0x0442;
+
+    static const wchar_t RUSSIAN_U_UPPER = 0x0423;
+    static const wchar_t RUSSIAN_U_LOWER = 0x0443;
+
+    static const wchar_t RUSSIAN_EF_UPPER = 0x0424;
+    static const wchar_t RUSSIAN_EF_LOWER = 0x0444;
+
+    static const wchar_t RUSSIAN_HA_UPPER = 0x0425;
+    static const wchar_t RUSSIAN_HA_LOWER = 0x0445;
+
+    static const wchar_t RUSSIAN_TSE_UPPER = 0x0426;
+    static const wchar_t RUSSIAN_TSE_LOWER = 0x0446;
+
+    static const wchar_t RUSSIAN_CHE_UPPER = 0x0427;
+    static const wchar_t RUSSIAN_CHE_LOWER = 0x0447;
+
+    static const wchar_t RUSSIAN_SHA_UPPER = 0x0428;
+    static const wchar_t RUSSIAN_SHA_LOWER = 0x0448;
+
+    static const wchar_t RUSSIAN_SHCHA_UPPER = 0x0429;
+    static const wchar_t RUSSIAN_SHCHA_LOWER = 0x0449;
+
+    static const wchar_t RUSSIAN_HARD_SIGN_UPPER = 0x042A;
+    static const wchar_t RUSSIAN_HARD_SIGN_LOWER = 0x044A;
+
+    static const wchar_t RUSSIAN_YERU_UPPER = 0x042B;
+    static const wchar_t RUSSIAN_YERU_LOWER = 0x044B;
+
+    static const wchar_t RUSSIAN_SOFT_SIGN_UPPER = 0x042C;
+    static const wchar_t RUSSIAN_SOFT_SIGN_LOWER = 0x044C;
+
+    static const wchar_t RUSSIAN_E_UPPER = 0x042D;
+    static const wchar_t RUSSIAN_E_LOWER = 0x044D;
+
+    static const wchar_t RUSSIAN_YU_UPPER = 0x042E;
+    static const wchar_t RUSSIAN_YU_LOWER = 0x044E;
+
+    static const wchar_t RUSSIAN_YA_UPPER = 0x042F;
+    static const wchar_t RUSSIAN_YA_LOWER = 0x044F;
+
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class russian_stem
+        Russian stemming class.
+
+    PERFECTIVE GERUND:
+        - Group 1: в вши вшись
+        - Group 2: ив ивши ившись ыв ывши ывшись
+
+    Group 1 endings must follow 'а' or 'я'.
+    
+    REFLEXIVE:
+        - ся сь
+
+    NOUN:
+        - а ев ов ие ье е иями ями ами еи ии и ией ей ой ий й иям ям ием ем ам ом о у ах иях ях ы ь ию ью ю ия ья я
+
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for a PERFECTIVE GERUND ending. If one is found remove it,
+    and that is then the end of step 1. Otherwise try and remove a REFLEXIVE ending,
+    and then search in turn for:
+        -# an ADJECTIVAL,
+        -# a VERB or
+        -# a NOUN ending.
+    As soon as one of the endings (1) to (3) is found remove it, and terminate step 1.
+
+    <b>Step 2:</b>
+
+    If the word ends with 'и', then remove it.
+
+    <b>Step 3:</b>
+
+    Search for a DERIVATIONAL (ост, ость) ending in R2 (i.e., the entire ending must lie in R2), and if one is found, then remove it.
+
+    <b>Step 4:</b>
+
+    -# Undouble 'н', or
+    -# if the word ends with a SUPERLATIVE (ейш or ейше) ending, remove it and undouble 'н', or
+    -# if the word ends 'ь', then remove it.
+    */
+    template <typename string_typeT = std::wstring>
+    class russian_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 2)
+                { return; }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::find_r1(text, RUSSIAN_VOWELS);
+            stem<string_typeT>::find_r2(text, RUSSIAN_VOWELS);
+            stem<string_typeT>::find_russian_rv(text, RUSSIAN_VOWELS);
+
+            //change 33rd letter ('&#x0451;') to '&#x0435;'
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0x0451)
+                    { text[i] = RUSSIAN_IE_LOWER; }
+                else if (text[i] == 0x0401)
+                    { text[i] = RUSSIAN_IE_UPPER; }
+                }
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+            step_4(text);
+            }
+    private:
+        void step_1(string_typeT& text)
+            {
+            //search for a perfect gerund
+            //group 2
+            if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER,
+                                   RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                   RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                   RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                   RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                   RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                   RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                   RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                   RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                   RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                   RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) )
+                { return; }
+            //group 1
+            else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                        RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                        RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                        RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                        RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) )
+                {
+                if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER,
+                                    RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                    RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                    RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                    RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                    RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) ||
+                    stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER,
+                                    RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                    RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                    RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                    RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                    RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) )
+                    {
+                    text.erase(text.end()-5, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            //group 2
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                        RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                        RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                        RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                     stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER,
+                                        RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                        RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                        RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) )
+                { return; }
+            //group 1
+            else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                        RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                        RUSSIAN_I_LOWER, RUSSIAN_I_UPPER) )
+                {
+                if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER,
+                                    RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                    RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                    RUSSIAN_I_LOWER, RUSSIAN_I_UPPER) ||
+                    stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER,
+                                    RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER,
+                                    RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                    RUSSIAN_I_LOWER, RUSSIAN_I_UPPER) )
+                    {
+                    text.erase(text.end()-3, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            //group 2
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) )
+                { return; }
+            //group 1
+            else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER) )
+                {
+                if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER) ||
+                    stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER) )
+                    {
+                    text.erase(text.end()-1, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            //reflexive
+            if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) )
+                { /*NOOP*/ }
+            //adjectival
+            if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_UPPER, RUSSIAN_YERU_LOWER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_GHE_LOWER, RUSSIAN_GHE_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_GHE_LOWER, RUSSIAN_GHE_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_HA_LOWER, RUSSIAN_HA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_HA_LOWER, RUSSIAN_HA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) )
+                {
+                //delete participles
+                //group 2
+                if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER, false) ||
+                    stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER, false) ||
+                    stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, RUSSIAN_SHCHA_LOWER, RUSSIAN_SHCHA_UPPER, false) )
+                    {/*NOOP*/}
+                //group 1
+                else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER) ||
+                        stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER) ||
+                        stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER) ||
+                        stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, RUSSIAN_SHCHA_LOWER, RUSSIAN_SHCHA_UPPER) )
+                    {
+                    if (text.length() >= 3 &&
+                        stem<string_typeT>::get_rv() <= text.length()-3 &&
+                        (is_either<wchar_t>(text[text.length()-3], RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                        is_either<wchar_t>(text[text.length()-3], RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER)) )
+                        {
+                        text.erase(text.end()-2, text.end() );
+                        stem<string_typeT>::update_r_sections(text);
+                        return;
+                        }
+                    }
+                else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_SHCHA_LOWER, RUSSIAN_SHCHA_UPPER) )
+                    {
+                    if (text.length() >= 2 &&
+                        stem<string_typeT>::get_rv() <= text.length()-2 &&
+                        (is_either<wchar_t>(text[text.length()-2], RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                        is_either<wchar_t>(text[text.length()-2], RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER)) )
+                        {
+                        text.erase(text.end()-1, text.end() );
+                        stem<string_typeT>::update_r_sections(text);
+                        return;
+                        }
+                    }
+                return;
+                }
+            //verb
+            //group 2
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||/*4*/
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) )
+                {
+                return;
+                }
+            //group 1
+            if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER) )
+                {
+                if (text.length() >= 4 &&
+                    stem<string_typeT>::get_rv() <= text.length()-4 &&
+                    (is_either<wchar_t>(text[text.length()-4], RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                    is_either<wchar_t>(text[text.length()-4], RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER)) )
+                    {
+                    text.erase(text.end()-3, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            //group 2
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) )
+                {
+                return;
+                }
+            //group 1
+            else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||/*2*/
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) )
+                {
+                if (text.length() >= 3 &&
+                    stem<string_typeT>::get_rv() <= text.length()-3 &&
+                    (is_either<wchar_t>(text[text.length()-3], RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                    is_either<wchar_t>(text[text.length()-3], RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER)) )
+                    {
+                    text.erase(text.end()-2, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+            if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER) ||/*1*/
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EL_LOWER, RUSSIAN_EL_UPPER) ||
+                stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER) )
+                {
+                if (text.length() >= 2 &&
+                    stem<string_typeT>::get_rv() <= text.length()-2 &&
+                    (is_either<wchar_t>(text[text.length()-2], RUSSIAN_A_LOWER, RUSSIAN_A_UPPER) ||
+                    is_either<wchar_t>(text[text.length()-2], RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER)) )
+                    {
+                    text.erase(text.end()-1, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                }
+
+            //noun
+            if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER,
+                                   RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER,
+                                   RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER,
+                                   RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_HA_LOWER, RUSSIAN_HA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_VE_LOWER, RUSSIAN_VE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, RUSSIAN_HA_LOWER, RUSSIAN_HA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_EM_LOWER, RUSSIAN_EM_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, RUSSIAN_HA_LOWER, RUSSIAN_HA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_LOWER, RUSSIAN_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_A_LOWER, RUSSIAN_A_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_U_LOWER, RUSSIAN_U_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YU_LOWER, RUSSIAN_YU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YA_LOWER, RUSSIAN_YA_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_YERU_LOWER, RUSSIAN_YERU_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER, false) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER, false) )
+                { return; }
+            }
+        void step_2(string_typeT& text)
+            { stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_I_UPPER, RUSSIAN_I_LOWER); }
+        void step_3(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER,
+                                   RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                   RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER,
+                                   RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER,
+                                   RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                   RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER,
+                                   RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER,
+                                RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER) )
+                {
+                stem<string_typeT>::delete_if_is_in_r2(text, RUSSIAN_O_LOWER, RUSSIAN_O_UPPER,
+                                   RUSSIAN_ES_LOWER, RUSSIAN_ES_UPPER,
+                                   RUSSIAN_TE_LOWER, RUSSIAN_TE_UPPER);
+                }
+            }
+        void step_4(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER,
+                                RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER) )
+                {
+                text.erase(text.end()-1, text.end() );
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER,
+                                          RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER,
+                                          RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER,
+                                          RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER) ||
+                stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_IE_LOWER, RUSSIAN_IE_UPPER,
+                                          RUSSIAN_SHORT_I_LOWER, RUSSIAN_SHORT_I_UPPER,
+                                          RUSSIAN_SHA_LOWER, RUSSIAN_SHA_UPPER))
+                {
+                if (stem<string_typeT>::is_suffix_in_rv(text, RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER,
+                                RUSSIAN_EN_LOWER, RUSSIAN_EN_UPPER) )
+                    {
+                    text.erase(text.end()-1, text.end() );
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                }
+            else
+                { stem<string_typeT>::delete_if_is_in_rv(text, RUSSIAN_SOFT_SIGN_LOWER, RUSSIAN_SOFT_SIGN_UPPER); }
+            }
+        };
+    }
+
+#endif //__RUSSIAN_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/spanish_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/spanish_stem.h
new file mode 100644 (file)
index 0000000..952f7b6
--- /dev/null
@@ -0,0 +1,1396 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __SPANISH_STEM_H__
+#define __SPANISH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class spanish_stem
+        Spanish stemming class.
+
+    Letters in Spanish include the following accented forms:
+        - á é í ó ú ü ñ
+    
+    The following letters are vowels:
+        - a e i o u á é í ó ú ü
+    
+    R2 is defined in the usual way - see the note on R1 and R2.
+
+    RV is defined as follows (and this is not the same as the French stemmer definition):
+
+    If the second letter is a consonant, RV is the region after the next following vowel,
+    or if the first two letters are vowels, RV is the region after the next consonant,
+    and otherwise (consonant-vowel case) RV is the region after the third letter.
+    But RV is the end of the word if these positions cannot be found.
+
+    For example,
+
+        m a c h o     o l i v a     t r a b a j o     á u r e o
+             |...|         |...|         |.......|         |...|
+
+    \par Algorithm:
+
+    Always do steps 0 and 1.
+
+    <b>Step 0:</b>
+
+    Search for the longest among the following suffixes
+        - me se sela selo selas selos la le lo las les los nos
+            - Delete it, if comes after one of 
+                - iéndo ándo ár ér ír
+                - ando iendo ar er ir
+                - yendo, following u
+
+    in RV. In the case of (c), yendo must lie in RV, but the preceding u can be outside it.
+
+    In the case of (a), deletion is followed by removing the acute accent
+    (for example, haciéndola -> haciendo).
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes, and perform the action indicated.
+        - anza anzas ico ica icos icas ismo ismos able ables ible ibles ista istas oso osa osos osas amiento amientos imiento imientos
+            - Delete if in R2.
+        - adora ador ación adoras adores aciones ante antes ancia ancias
+            - Delete if in R2.
+            - If preceded by ic, delete if in R2
+        - logía logías
+            - Replace with log if in R2.
+        - ución uciones
+            - Replace with u if in R2.
+        - encia encias
+            - Replace with ente if in R2.
+        - amente
+            - Delete if in R1.
+            - If preceded by iv, delete if in R2 (and if further preceded by at, delete if in R2), otherwise,
+            - If preceded by os, ic or ad, delete if in R2.
+        - mente
+            - Delete if in R2.
+            - If preceded by ante, able or ible, delete if in R2.
+        - idad idades
+            - Delete if in R2
+            - If preceded by abil, ic or iv, delete if in R2.
+        - iva ivo ivas ivos
+            - Delete if in R2.
+            - If preceded by at, delete if in R2.
+
+    Do step 2(a) if no ending was removed by step 1.
+
+    <b>Step 2(a):</b>
+
+    Search for the longest among the following suffixes in RV, and if found, delete if preceded by u.
+        - ya ye yan yen yeron yendo yo yó yas yes yais yamos
+
+    (Note that the preceding u need not be in RV).
+
+    <b>Step 2(b):</b>
+
+    Do Step 2(b) if step 2(a) was done, but failed to remove a suffix.
+
+    Search for the longest among the following suffixes in RV, and perform the action indicated.
+            - en es éis emos
+                - Delete, and if preceded by gu delete the u (the gu need not be in RV).
+            - arían arías arán arás aríais aría aréis aríamos aremos ará aré erían erías
+            erán erás eríais ería eréis eríamos eremos erá eré irían irías irán irás iríais
+            iría iréis iríamos iremos irá iré aba ada ida ía ara iera ad ed id ase iese aste
+            iste an aban ían aran ieran asen iesen aron ieron ado ido ando iendo ió ar er ir
+            as abas adas idas ías aras ieras ases ieses ís áis abais íais arais ierais
+            aseis ieseis asteis isteis ados idos amos ábamos íamos imos áramos iéramos iésemos ásemos
+                - Delete.
+
+    Always do step 3.
+
+    <b>Step 3:</b>
+
+    Search for the longest among the following suffixes in RV, and perform the action indicated.
+            - os a o á í ó
+                - Delete if in RV.
+            - e é
+                - Delete if in RV, and if preceded by gu with the u in RV delete the u.
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class spanish_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                stem<string_typeT>::remove_spanish_acutes(text);
+                return;
+                }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            stem<string_typeT>::find_r1(text, SPANISH_VOWELS);
+            stem<string_typeT>::find_r2(text, SPANISH_VOWELS);
+            stem<string_typeT>::find_spanish_rv(text, SPANISH_VOWELS);
+
+            step_0(text);
+            step_1(text);
+            ///steps 2a and 2b and only called from step1
+            step_3(text);
+
+            stem<string_typeT>::remove_spanish_acutes(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_0(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_rv(text,/*selos*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 5))
+                    { return; }
+                if (step_0b(text, 5))
+                    { return; }
+                if (step_0c(text, 5))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*selas*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 5))
+                    { return; }
+                if (step_0b(text, 5))
+                    { return; }
+                if (step_0c(text, 5))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*sela*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A))
+                {
+                if (step_0a(text, 4))
+                    { return; }
+                if (step_0b(text, 4))
+                    { return; }
+                if (step_0c(text, 4))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*selo*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O))
+                {
+                if (step_0a(text, 4))
+                    { return; }
+                if (step_0b(text, 4))
+                    { return; }
+                if (step_0c(text, 4))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*las*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 3))
+                    { return; }
+                if (step_0b(text, 3))
+                    { return; }
+                if (step_0c(text, 3))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*les*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 3))
+                    { return; }
+                if (step_0b(text, 3))
+                    { return; }
+                if (step_0c(text, 3))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*los*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 3))
+                    { return; }
+                if (step_0b(text, 3))
+                    { return; }
+                if (step_0c(text, 3))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*nos*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (step_0a(text, 3))
+                    { return; }
+                if (step_0b(text, 3))
+                    { return; }
+                if (step_0c(text, 3))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*la*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A))
+                {
+                if (step_0a(text, 2))
+                    { return; }
+                if (step_0b(text, 2))
+                    { return; }
+                if (step_0c(text, 2))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*le*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E))
+                {
+                if (step_0a(text, 2))
+                    { return; }
+                if (step_0b(text, 2))
+                    { return; }
+                if (step_0c(text, 2))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*lo*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O))
+                {
+                if (step_0a(text, 2))
+                    { return; }
+                if (step_0b(text, 2))
+                    { return; }
+                if (step_0c(text, 2))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*me*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E))
+                {
+                if (step_0a(text, 2))
+                    { return; }
+                if (step_0b(text, 2))
+                    { return; }
+                if (step_0c(text, 2))
+                    { return; }
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*se*/common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E))
+                {
+                if (step_0a(text, 2))
+                    { return; }
+                if (step_0b(text, 2))
+                    { return; }
+                if (step_0c(text, 2))
+                    { return; }
+                return;
+                }
+            }
+        //---------------------------------------------
+        bool step_0a(string_typeT& text, size_t suffix_length)
+            {
+            if ((text.length() >= suffix_length+5) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(5+suffix_length)) &&
+                /*iéndo*/
+                (is_either<wchar_t>(text[text.length()-(5+suffix_length)], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE) &&
+                    is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                text[text.length()-4] = common_lang_constants::LOWER_E;
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+4) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(4+suffix_length)) &&
+                /*ándo*/
+                (is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE) &&
+                    is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                text[text.length()-4] = common_lang_constants::LOWER_A;
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*ár*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                text[text.length()-2] = common_lang_constants::LOWER_A;
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*ér*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                text[text.length()-2] = common_lang_constants::LOWER_E;
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length + 2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*ír*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                text[text.length()-2] = common_lang_constants::LOWER_I;
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            return false;
+            }
+
+        //---------------------------------------------
+        bool step_0b(string_typeT& text, size_t suffix_length)
+            {
+            if ((text.length() >= suffix_length+5) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(5+suffix_length)) &&
+                /*iendo*/
+                (is_either<wchar_t>(text[text.length()-(5+suffix_length)], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+4) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(4+suffix_length)) &&
+                /*ando*/
+                (is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*ar*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*er*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            else if ((text.length() >= suffix_length+2) &&
+                stem<string_typeT>::get_rv() <= (text.length()-(2+suffix_length)) &&
+                /*ir*/
+                (is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_I, common_lang_constants::UPPER_I) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            return false;
+            }
+
+        //---------------------------------------------
+        bool step_0c(string_typeT& text, size_t suffix_length)
+            {
+            if ((text.length() >= suffix_length+6) &&
+                stem<string_typeT>::get_rv() <= text.length()-(suffix_length+5) &&
+                /*uyendo*/
+                (is_either<wchar_t>(text[text.length()-(6+suffix_length)], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) &&
+                    is_either<wchar_t>(text[text.length()-(5+suffix_length)], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) &&
+                    is_either<wchar_t>(text[text.length()-(4+suffix_length)], common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) &&
+                    is_either<wchar_t>(text[text.length()-(3+suffix_length)], common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) &&
+                    is_either<wchar_t>(text[text.length()-(2+suffix_length)], common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) &&
+                    is_either<wchar_t>(text[text.length()-(1+suffix_length)], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) ) )
+                {
+                text.erase(text.length()-suffix_length);
+                stem<string_typeT>::update_r_sections(text);
+                return true;
+                }
+            return false;
+            }
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            size_t original_length = text.length();
+            if (stem<string_typeT>::delete_if_is_in_r2(text,/*imientos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*amientos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*uciones*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-6);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*amiento*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*imiento*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*aciones*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*logías*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-3);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*encias*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                text.erase(text.length()-2);
+                text[text.length()-2] = common_lang_constants::LOWER_T;
+                text[text.length()-1] = common_lang_constants::LOWER_E;
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*idades*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                        {
+                        return;
+                        }
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*amente*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (original_length > text.length() )
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                        {
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                        return;
+                        }
+                    else
+                        {
+                        if (stem<string_typeT>::delete_if_is_in_r2(text,/*os*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                            stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                            stem<string_typeT>::delete_if_is_in_r2(text,/*ad*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                            {
+                            return;
+                            }
+                        }
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*adores*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                     stem<string_typeT>::delete_if_is_in_r2(text,/*adoras*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                     stem<string_typeT>::delete_if_is_in_r2(text,/*ancias*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*adora*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) ||
+                     stem<string_typeT>::delete_if_is_in_r2(text,/*ación*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) ||
+                     stem<string_typeT>::delete_if_is_in_r2(text,/*antes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) ||
+                     stem<string_typeT>::delete_if_is_in_r2(text,/*ancia*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ibles*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*istas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ables*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ismos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*anzas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*logía*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                text.erase(text.length()-2);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*ución*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                text.erase(text.length()-4);
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r2(text,/*encia*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                text.erase(text.length()-1);
+                text[text.length()-2] = common_lang_constants::LOWER_T;
+                text[text.length()-1] = common_lang_constants::LOWER_E;
+                stem<string_typeT>::update_r_sections(text);
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*mente*/common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (original_length > text.length() )
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r2(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*able*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ible*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                        {
+                        return;
+                        }
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*anza*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_Z, common_lang_constants::UPPER_Z, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*icos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*icas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ismo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*able*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ible*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ista*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osos*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osas*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ador*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ||
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ante*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*idad*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                if (original_length > text.length() )
+                    {
+                    if (stem<string_typeT>::delete_if_is_in_r2(text,/*abil*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*ic*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) ||
+                        stem<string_typeT>::delete_if_is_in_r2(text,/*iv*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V) )
+                        {
+                        return;
+                        }
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ico*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ica*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_C, common_lang_constants::UPPER_C, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*oso*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*osa*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*iva*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    return;
+                    }
+                step_2a(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r2(text,/*ivo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_V, common_lang_constants::UPPER_V, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                if (original_length > text.length() )
+                    {
+                    stem<string_typeT>::delete_if_is_in_r2(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T);
+                    return;
+                    }
+                step_2a(text);
+                }    
+            //this should only be called from here if nothing was removed in step 1
+            if (text.length() == original_length)
+                {
+                step_2a(text);
+                }
+            }
+        //---------------------------------------------
+        void step_2a(string_typeT& text)
+            {
+            size_t original_length = text.length();
+            if (stem<string_typeT>::is_suffix_in_rv(text,/*yeron*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N))
+                {
+                if (is_either<wchar_t>(text[text.length()-6], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yendo*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O))
+                {
+                if (text.length() >= 6 &&
+                    is_either<wchar_t>(text[text.length()-6], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yamos*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (text.length() >= 6 &&
+                    is_either<wchar_t>(text[text.length()-6], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-5);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yais*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (text.length() >= 5 &&
+                    is_either<wchar_t>(text[text.length()-5], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-4);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yan*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N))
+                {
+                if (text.length() >= 4 &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yen*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N))
+                {
+                if (text.length() >= 4 &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yas*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (text.length() >= 4 &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yes*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S))
+                {
+                if (text.length() >= 4 &&
+                    is_either<wchar_t>(text[text.length()-4], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-3);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ya*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A))
+                {
+                if (text.length() >= 3 &&
+                    is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*ye*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E))
+                {
+                if (text.length() >= 3 &&
+                    is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yo*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O))
+                {
+                if (text.length() >= 3 &&
+                    is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_rv(text,/*yó*/common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE))
+                {
+                if (text.length() >= 3 &&
+                    is_either<wchar_t>(text[text.length()-3], common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-2);
+                    stem<string_typeT>::update_r_sections(text);
+                    return;
+                    }
+                step_2b(text);
+                }
+            //only called if 2a fails to remove a suffix
+            if (text.length() == original_length)
+                {
+                step_2b(text);
+                }
+            }
+        //---------------------------------------------
+        void step_2b(string_typeT& text) 
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*aríamos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eríamos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iríamos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iéramos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iésemos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aríais*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aremos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eríais*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eremos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iríais*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iremos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ierais*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ieseis*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asteis*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*isteis*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ábamos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*áramos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ásemos*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arían*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arías*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aréis*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erían*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erías*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eréis*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irían*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irías*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iréis*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ieran*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iesen*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ieron*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iendo*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ieras*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ieses*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*abais*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arais*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aseis*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íamos*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*emos*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arán*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*arás*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aría*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erán*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erás*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ería*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irán*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irás*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iría*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iera*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iese*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aste*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iste*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aban*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aran*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*asen*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aron*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ando*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*abas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*adas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*idas*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aras*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ases*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*íais*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ados*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*idos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*amos*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*imos*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_M, common_lang_constants::UPPER_M, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ará*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aré*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*erá*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*eré*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*irá*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*iré*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*aba*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_B, common_lang_constants::UPPER_B, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ada*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ida*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ara*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ase*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ían*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ado*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ido*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ías*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*áis*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*éis*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ía*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ad*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ed*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*id*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*an*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ió*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ar*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ir*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*as*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ís*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                if (stem<string_typeT>::is_suffix(text,/*gu*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U) )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+         //---------------------------------------------
+        void step_3(string_typeT& text) 
+            {
+            if (stem<string_typeT>::delete_if_is_in_rv(text,/*os*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*a*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*o*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*á*/common_lang_constants::LOWER_A_ACUTE, common_lang_constants::UPPER_A_ACUTE) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*í*/common_lang_constants::LOWER_I_ACUTE, common_lang_constants::UPPER_I_ACUTE) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*ó*/common_lang_constants::LOWER_O_ACUTE, common_lang_constants::UPPER_O_ACUTE) )
+                {
+                return;
+                }
+
+            else if (stem<string_typeT>::delete_if_is_in_rv(text,/*é*/common_lang_constants::LOWER_E_ACUTE, common_lang_constants::UPPER_E_ACUTE) ||
+                    stem<string_typeT>::delete_if_is_in_rv(text,/*e*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E) )
+                {
+                if (stem<string_typeT>::is_suffix_in_rv(text,/*u*/common_lang_constants::LOWER_U, common_lang_constants::UPPER_U))
+                    {
+                    if (text.length() >= 2 &&
+                        is_either<wchar_t>(text[text.length()-2], common_lang_constants::LOWER_G, common_lang_constants::UPPER_G) )
+                        {
+                        text.erase(text.length()-1);
+                        }
+                    }
+                return;
+                }
+            }
+        };
+    }
+
+#endif //__SPANISH_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/stemming.h b/third-party/include/OleanderStemmingLibrary/stemming/stemming.h
new file mode 100644 (file)
index 0000000..4483846
--- /dev/null
@@ -0,0 +1,2337 @@
+/**
+\date 2003-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __STEM_H__
+#define __STEM_H__
+
+#include <algorithm>
+#include "../indexing/string_util.h"
+#include "../indexing/common_lang_constants.h"
+
+namespace stemming
+    {
+    enum stemming_type
+        {
+        no_stemming,
+        danish,
+        dutch,
+        english,
+        finnish,
+        french,
+        german,
+        italian,
+        norwegian,
+        portuguese,
+        spanish,
+        swedish,
+        STEMMING_TYPE_COUNT
+        };
+    //these characters should not appear in an indexed word
+    const wchar_t UPPER_Y_HASH = 7;//bell
+    const wchar_t LOWER_Y_HASH = 9;//tab
+    const wchar_t UPPER_I_HASH = 10;//line feed
+    const wchar_t LOWER_I_HASH = 11;//vertical tab
+    const wchar_t UPPER_U_HASH = 12;//form feed (new page)
+    const wchar_t LOWER_U_HASH = 13;//carriage return
+
+    //language constants
+    static const wchar_t FRENCH_VOWELS[] = { 97, 101, 105, 111, 117, 121, 0xE2,
+        0xE0, 0xEB, 0xE9,
+        0xEA, 0xE8, 0xEF,
+        0xEE, 0xF4, 0xFB,
+        0xF9, 65, 69, 73, 79, 85, 89, 0xC2,
+        0xC0, 0xCB, 0xC9,
+        0xCA, 0xC8, 0xCF,
+        0xCE, 0xD4, 0xDB,
+        0xD9, 0 };
+    static const wchar_t FRENCH_ACCENTED_E[] = { 0xE9, 0xE8,
+        0xC9, 0xC8, 0 };
+    static const wchar_t FRENCH_AIOUES[] = { 97, 105, 111, 117, 0xE8, 115, 65, 73, 79, 85,
+        0xC8, 83, 0 };
+
+    static const wchar_t GERMAN_VOWELS[] = { 97, 101, 105, 111, 117, 0xFC, 121,
+        0xE4, 0xF6, 65, 0xC4,
+        69, 73, 79, 0xD6, 85, 0xDC, 89, 0 };
+
+    static const wchar_t DANISH_VOWELS[] = { 97, 101, 105, 111, 117, 121, 0xE6,
+        0xE5, 0xF8, 65, 69, 73, 79, 85, 89,
+        0xC6, 0xC5, 0xD8, 0 };
+    static const wchar_t DANISH_ALPHABET[] = { 97, 98, 99, 100, 102, 103, 104, 106, 107, 108, 109, 110, 111, 112, 114,
+        116, 118, 121, 122, 0xE5, 65, 66, 67, 68, 70, 71, 72, 74, 75, 76, 77, 78, 79,
+        80, 82, 84, 86, 89, 90, 0xC5, 0 };
+
+    static const wchar_t FINNISH_VOWELS[] = { 97, 101, 105, 111, 117, 121, 0xE4, 0xF6, 65, 69, 73, 79, 85, 89,
+        0xC4, 0xD6, 0 };
+    static const wchar_t FINNISH_VOWELS_NO_Y[] = { 97, 101, 105, 111, 117, 0xE4, 0xF6, 65, 69, 73, 79, 85,
+        0xC4, 0xD6, 0 };
+    static const wchar_t FINNISH_VOWELS_SIMPLE[] = { 97, 101, 105, 0xE4, 65, 69, 73, 0xC4, 0 };
+    static const wchar_t FINNISH_STEP_1_SUFFIX[] = { 110, 116, 97, 101, 105, 111, 117, 121, 0xE4,
+        0xF6, 78, 84, 65, 69, 73, 79, 85, 89, 0xC4, 0xD6, 0 };
+
+    static const wchar_t DUTCH_VOWELS[] = { 97, 101, 105, 111, 117, 121, 0xE8,
+        65, 69, 73, 79, 85, 89, 0xC8, 0 };
+    static const wchar_t DUTCH_KDT[] = { 107, 100, 116, 75, 68, 84, 0 };
+    static const wchar_t DUTCH_S_ENDING[] = { 97, 101, 0xE8, 105, 111, 117, 121, 106, 65, 69,
+        0xC8, 73, 79, 85, 89, 74, 0 };
+
+    static const wchar_t NORWEGIAN_VOWELS[] = { 97, 101, 105, 111, 0xF8, 117, 121, 0xE5,
+        0xE6, 0xC5, 65, 0xC6, 69, 73, 79,
+        0xD8, 85, 89, 0 };
+    static const wchar_t PORTUGUESE_VOWELS[] = { 97, 101, 105, 111, 117, 0xE1, 0xE9,
+        0xED, 0xF3, 0xFA, 0xE2,
+        0xEA, 0xF4, 65, 69, 73, 79, 85, 0xC1,
+        0xC9, 0xCD, 0xD3, 0xDA,
+        0xC2, 0xCA, 0xD4, 0 };
+    static const wchar_t SPANISH_VOWELS[] = { 97, 101, 105, 111, 117, 0xE1, 0xE9,
+        0xED, 0xF3, 0xFA, 0xFC,
+        65, 69, 73, 79, 85, 0xC1, 0xC9, 0xCD,
+        0xD3, 0xDA, 0xDC, 0 };
+
+    static const wchar_t SWEDISH_VOWELS[] = { 97, 101, 105, 111, 117, 121, 0xE5,
+        0xE4, 0xF6, 65, 69, 73, 79, 85, 89,
+        0xC5, 0xC4, 0xD6, 0 };
+
+    static const wchar_t ITALIAN_VOWELS[] = { 97, 101, 105, 111, 117, 0xE0,
+        0xE8, 0xEC, 0xF2,
+        0xF9, 65, 69, 73, 79, 85, 0xC0,
+        0xC8, 0xCC, 0xD2,
+        0xD9, 0 };
+    static const wchar_t ITALIAN_VOWELS_SIMPLE[] = { 97, 101, 105, 111, 0xE0,
+        0xE8, 0xEC, 0xF2,
+        65, 69, 73, 79, 0xC0, 0xC8,
+        0xCC, 0xD2, 0 };
+
+    /**\addtogroup Stemming
+        Language-specific stemming classes.
+    * @{*/
+    /**
+       @class stem
+       @brief The base class for language-specific stemmers. The template argument for the stemmers are the type
+       of std::basic_string that you are trying to stem, by default std::wstring (Unicode strings).
+       As long as the char type of your basic_string is wchar_t, then you can use any type of basic_string.
+       This is to say, if your basic_string has a custom char_traits or allocator, then just specify it in
+       your template argument to the stemmer. Example:
+       \code
+        typedef std::basic_string<wchar_t, myTraits, myAllocator> myString;
+        myString word(L"documentation");
+        stemming::english_stem<myString> StemEnglish;
+        StemEnglish(word);
+       \endcode */
+    template <typename string_typeT = std::wstring>
+    class stem
+        {
+    public:
+        stem() : m_r1(0), m_r2(0), m_rv(0) {}
+    protected:
+        //R1, R2, RV functions
+        void find_r1(const string_typeT& text,
+                    const wchar_t* vowel_list)
+            {
+            //see where the R1 section begin
+            //R1 is the region after the first consonant after the first vowel
+            size_t start = text.find_first_of(vowel_list, 0);
+            if (start == string_typeT::npos)
+                {
+                //we need at least need a vowel somewhere in the word
+                m_r1 = text.length();
+                return;
+                }
+
+            m_r1 = text.find_first_not_of(vowel_list,++start);
+            if (get_r1() == string_typeT::npos)
+                {
+                m_r1 = text.length();
+                }
+            else
+                {
+                ++m_r1;
+                }
+            }
+
+        void find_r2(const string_typeT& text,
+                    const wchar_t* vowel_list)
+            {
+            size_t start = 0;
+            //look for R2--not required for all criteria.
+            //R2 is the region after the first consonant after the first vowel after R1
+            if (get_r1() != text.length() )
+                {
+                start = text.find_first_of(vowel_list, get_r1());
+                }
+            else
+                {
+                start = string_typeT::npos;
+                }
+            if (start != string_typeT::npos &&
+                static_cast<int>(start) != static_cast<int>(text.length())-1)
+                {
+                m_r2 = text.find_first_not_of(vowel_list,++start);
+                if (get_r2() == string_typeT::npos)
+                    {
+                    m_r2 = text.length();
+                    }
+                else
+                    {
+                    ++m_r2;
+                    }
+                }
+            else
+                {
+                m_r2 = text.length();
+                }
+            }
+
+        void find_spanish_rv(const string_typeT& text,
+                    const wchar_t* vowel_list)
+            {
+            //see where the RV section begin
+            if (text.length() < 4)
+                {
+                m_rv = text.length();
+                return;
+                }
+            //if second letter is a consonant
+            if (!string_util::is_one_of(text[1], vowel_list) )
+                {
+                size_t start = text.find_first_of(vowel_list, 2);
+                if (start == string_typeT::npos)
+                    {
+                    //can't find next vowel
+                    m_rv = text.length();
+                    return;
+                    }
+                else
+                    {
+                    m_rv = start+1;
+                    }
+                }
+            //if first two letters are vowels
+            else if (string_util::is_one_of(text[0], vowel_list) &&
+                    string_util::is_one_of(text[1], vowel_list))
+                {
+                size_t start = text.find_first_not_of(vowel_list, 2);
+                if (start == string_typeT::npos)
+                    {
+                    //can't find next consonant
+                    m_rv = text.length();
+                    return;
+                    }
+                else
+                    {
+                    m_rv = start+1;
+                    }
+                }
+            //consonant/vowel at beginning
+            else if (!string_util::is_one_of(text[0], vowel_list) &&
+                    string_util::is_one_of(text[1], vowel_list))
+                {
+                m_rv = 3;
+                }
+            else
+                {
+                m_rv = text.length();
+                }
+            }
+
+        /*If the word begins with two vowels, RV is the region after the third letter,
+        otherwise the region after the first vowel not at the beginning of the word,
+        or the end of the word if these positions cannot be found.
+        (Exceptionally, par, col or tap, at the begining of a word is also taken to be the region before RV.)*/
+        void find_french_rv(const string_typeT& text,
+                    const wchar_t* vowel_list)
+            {
+            //see where the RV section begin
+            if (text.length() < 3)
+                {
+                m_rv = text.length();
+                return;
+                }
+            /*Exceptions: If the word begins with these then RV goes right after them,
+            whether it be a letter or simply the end of the word.*/
+            if (text.length() >= 3 &&
+                ((is_either<wchar_t>(text[0], common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) &&
+                is_either<wchar_t>(text[1], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                is_either<wchar_t>(text[2], common_lang_constants::LOWER_R, common_lang_constants::UPPER_R) ) || //par
+
+                (is_either<wchar_t>(text[0], common_lang_constants::LOWER_C, common_lang_constants::UPPER_C) &&
+                is_either<wchar_t>(text[1], common_lang_constants::LOWER_O, common_lang_constants::UPPER_O) &&
+                is_either<wchar_t>(text[2], common_lang_constants::LOWER_L, common_lang_constants::UPPER_L) ) || //col
+
+                (is_either<wchar_t>(text[0], common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) &&
+                is_either<wchar_t>(text[1], common_lang_constants::LOWER_A, common_lang_constants::UPPER_A) &&
+                is_either<wchar_t>(text[2], common_lang_constants::LOWER_P, common_lang_constants::UPPER_P) ))//tap
+                )
+                {
+                m_rv = 3;
+                return;
+                }
+            //if first two letters are vowels
+            if (string_util::is_one_of(text[0], vowel_list) &&
+                string_util::is_one_of(text[1], vowel_list))
+                {
+                m_rv = 3;
+                }
+            else
+                {
+                size_t start = text.find_first_not_of(vowel_list, 0);
+                if (start == string_typeT::npos)
+                    {
+                    //can't find first consonant
+                    m_rv = text.length();
+                    return;
+                    }
+                start = text.find_first_of(vowel_list, start);
+                if (start == string_typeT::npos)
+                    {
+                    //can't find first vowel
+                    m_rv = text.length();
+                    return;
+                    }
+                m_rv = start+1;
+                }
+            }
+
+        void find_russian_rv(const string_typeT& text,
+                    const wchar_t* vowel_list)
+            {
+            size_t start = text.find_first_of(vowel_list);
+            if (start == string_typeT::npos)
+                {
+                //can't find first vowel
+                m_rv = text.length();
+                return;
+                }
+            else
+                {
+                m_rv = start+1;
+                }
+            }
+
+        inline void update_r_sections(const string_typeT& text)
+            {
+            if (get_r1() > text.length() )
+                {
+                m_r1 = text.length();
+                }
+            if (get_r2() > text.length() )
+                {
+                m_r2 = text.length();
+                }
+            if (get_rv() > text.length() )
+                {
+                m_rv = text.length();
+                }
+            }
+        /**Determines if a character is an apostrophe (includes straight single quotes).
+        @param ch The letter to be analyzed.*/
+        inline bool is_apostrophe(const wchar_t& ch) const
+            {
+            return (ch == 39) ? //'
+                true : (ch == 146) ? //apostrophe
+                true : (ch == 180) ? //apostrophe
+                true : (ch == 0x2019) ? //right single apostrophe
+                true : false;
+            }
+        //---------------------------------------------
+        void trim_western_punctuation(string_typeT& text) const
+            {
+            if (text.length() >= 3 &&
+                is_apostrophe(text[text.length()-3]) &&
+                is_either<wchar_t>(text[text.length()-2], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) &&
+                is_apostrophe(text[text.length()-1]) )
+                { text.erase(text.length()-3); }
+            else if (text.length() >= 2 &&
+                is_apostrophe(text[text.length()-2]) &&
+                is_either<wchar_t>(text[text.length()-1], common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                { text.erase(text.length()-2); }
+            else if (is_apostrophe(text[text.length()-1]))
+                { text.erase(text.length()-1); }
+            while (text.length() )
+                {
+                const wchar_t lastChar = text[text.length()-1];
+                if (!(lastChar >= 48 && lastChar <= 57) &&
+                    !(lastChar >= 65 && lastChar <= 90) &&
+                    !(lastChar >= 97 && lastChar <= 122) &&
+                    !(lastChar >= 192 && lastChar <= 246) &&
+                    !(lastChar >= 248 && lastChar <= 255) &&
+                    lastChar != 0xA0)//space
+                    {
+                    text.erase(text.length()-1);
+                    }
+                else
+                    { break; }
+                }
+            while (text.length() )
+                {
+                if (!(text[0] >= 48 && text[0] <= 57) &&
+                    !(text[0] >= 65 && text[0] <= 90) &&
+                    !(text[0] >= 97 && text[0] <= 122) &&
+                    !(text[0] >= 192 && text[0] <= 246) &&
+                    !(text[0] >= 248 && text[0] <= 255) )
+                    { text.erase(0, 1); }
+                else
+                    { break; }
+                }
+            }
+
+        //suffix removal determinant functions
+        ///is_suffix for one character
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U) const
+            {
+            if (text.length() < 1)
+                { return false; }
+            return is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U);
+            }
+        ///is_suffix for two characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U) const
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U);
+            }
+
+        ///is_suffix for three characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U) const
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U);
+            }
+        ///is_suffix for four characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U) const
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U);
+            }
+        ///is_suffix for five characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U) const
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U);
+            }
+        ///is_suffix for six characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U) const
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U);
+            }
+        ///is_suffix for seven characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U) const
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U);
+            }
+        ///is_suffix for eight characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const wchar_t suffix8L, const wchar_t suffix8U) const
+            {
+            if (text.length() < 8)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-8], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-7], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix7L, suffix7U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix8L, suffix8U);
+            }
+        ///is_suffix for nine characters
+        inline bool is_suffix(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const wchar_t suffix8L, const wchar_t suffix8U,
+                    const wchar_t suffix9L, const wchar_t suffix9U) const
+            {
+            if (text.length() < 9)
+                {
+                return false;
+                }
+            return is_either<wchar_t>(text[text.length()-9], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-8], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-7], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix7L, suffix7U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix8L, suffix8U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix9L, suffix9U);
+            }
+
+        ///comparison for two characters
+        inline bool is_partial_suffix(const string_typeT& text,
+                    const size_t start_index,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U)
+            {
+            if ((start_index+2) >= text.length())
+                { return false; }
+            return (is_either<wchar_t>(text[start_index], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[start_index+1], suffix2L, suffix2U));
+            }
+        ///comparison for three characters
+        inline bool is_partial_suffix(const string_typeT& text,
+                    const size_t start_index,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U)
+            {
+            if ((start_index+3) >= text.length())
+                { return false; }
+            return (is_either<wchar_t>(text[start_index], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[start_index+1], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[start_index+2], suffix3L, suffix3U));
+            }
+
+        ///RV suffix functions
+        //-------------------------------------------------
+        ///RV suffix comparison for one character
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U)
+            {
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            return (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U) &&
+                    (get_rv() <= text.length()-1) );
+            }
+        ///RV suffix comparison for two characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U) ) &&
+                    (get_rv() <= text.length()-2) );
+            }
+        ///RV suffix comparison for three characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) ) &&
+                    (get_rv() <= text.length()-3) );
+            }
+        ///RV suffix comparison for four characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) ) &&
+                    (get_rv() <= text.length()-4) );
+            }
+        ///RV suffix comparison for five characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) ) &&
+                    (get_rv() <= text.length()-5) );
+            }
+        ///RV suffix comparison for six characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) ) &&
+                    (get_rv() <= text.length()-6) );
+            }
+        ///RV suffix comparison for seven characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U)
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U) ) &&
+                    (get_rv() <= text.length()-7) );
+            }
+        ///RV suffix comparison for eight characters
+        inline bool is_suffix_in_rv(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const wchar_t suffix8L, const wchar_t suffix8U)
+            {
+            if (text.length() < 8)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-8], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-7], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix7L, suffix7U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix8L, suffix8U) ) &&
+                    (get_rv() <= text.length()-8) );
+            }
+
+        ///R1 suffix functions
+        //-------------------------------------------------
+        ///R1 suffix comparison for one character
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U)
+            {
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            return (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U) &&
+                    (get_r1() <= text.length()-1) );
+            }
+        ///R1 suffix comparison for two characters
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U) ) &&
+                    (get_r1() <= text.length()-2) );
+            }
+        ///R1 suffix comparison for three characters
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) ) &&
+                    (get_r1() <= text.length()-3) );
+            }
+        ///R1 suffix comparison for four characters
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) ) &&
+                    (get_r1() <= text.length()-4) );
+            }
+        ///R1 suffix comparison for five characters
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) ) &&
+                    (get_r1() <= text.length()-5) );
+            }
+        ///R1 suffix comparison for six characters
+        inline bool is_suffix_in_r1(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) ) &&
+                    (get_r1() <= text.length()-6) );
+            }
+
+        ///R2 suffix functions
+        //-------------------------------------------------
+        ///R2 suffix comparison for one character
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U)
+            {
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            return (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U) &&
+                    (get_r2() <= text.length()-1) );
+            }
+        ///R2 suffix comparison for two characters
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U) ) &&
+                    (get_r2() <= text.length()-2) );
+            }
+        ///R2 suffix comparison for three characters
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) ) &&
+                    (get_r2() <= text.length()-3) );
+            }
+        ///R2 suffix comparison for four characters
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) ) &&
+                    (get_r2() <= text.length()-4) );
+            }
+        ///R2 suffix comparison for five characters
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) ) &&
+                    (get_r2() <= text.length()-5) );
+            }
+        ///R2 suffix comparison for six characters
+        inline bool is_suffix_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) ) &&
+                    (get_r2() <= text.length()-6) );
+            }
+        ///R2 suffix comparison for seven characters
+        inline bool is_suffix_in_r2(const string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U)
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            return ((is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                    is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                    is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                    is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                    is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                    is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                    is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U) ) &&
+                    (get_r2() <= text.length()-7) );
+            }
+
+        //suffix removal functions
+        //R1 deletion for one character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const bool success_on_find = true)
+            {
+            assert(suffix1L == string_util::tolower_western(suffix1U) );
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U))
+                {
+                if (get_r1() <= text.length()-1)
+                    {
+                    text.erase(text.length()-1);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for two character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U))
+                {
+                if (get_r1() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for three character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) )
+                {
+                if (get_r1() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for four character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) )
+                {
+                if (get_r1() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for five character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) )
+                {
+                if (get_r1() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for six character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) )
+                {
+                if (get_r1() <= text.length()-6)
+                    {
+                    text.erase(text.length()-6);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R1 deletion for seven character suffix
+        inline bool delete_if_is_in_r1(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U) )
+                {
+                if (get_r1() <= text.length()-7)
+                    {
+                    text.erase(text.length()-7);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+
+        //R2 deletion functions
+        //R2 deletion for one character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U))
+                {
+                if (get_r2() <= text.length()-1)
+                    {
+                    text.erase(text.length()-1);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R2 deletion for two character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U))
+                {
+                if (get_r2() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R2 deletion for three character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) )
+                {
+                if (get_r2() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //R2 deletion for four character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) )
+                {
+                if (get_r2() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        ///R2 deletion for five character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) )
+                {
+                if (get_r2() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        ///R2 deletion for six character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) )
+                {
+                if (get_r2() <= text.length()-6)
+                    {
+                    text.erase(text.length()-6);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        ///R2 deletion for seven character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U) )
+                {
+                if (get_r2() <= text.length()-7)
+                    {
+                    text.erase(text.length()-7);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        ///R2 deletion for eight character suffix
+        inline bool delete_if_is_in_r2(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const wchar_t suffix8L, const wchar_t suffix8U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 8)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-8], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-7], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-6], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix6L, suffix6U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix7L, suffix7U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix8L, suffix8U) )
+                {
+                if (get_r2() <= text.length()-8)
+                    {
+                    text.erase(text.length()-8);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        
+        //RV deletion functions
+        //RV deletion for one character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 1)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-1], suffix1L, suffix1U))
+                {
+                if (get_rv() <= text.length()-1)
+                    {
+                    text.erase(text.length()-1);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for two character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 2)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-2], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix2L, suffix2U))
+                {
+                if (get_rv() <= text.length()-2)
+                    {
+                    text.erase(text.length()-2);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for three character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 3)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-3], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix3L, suffix3U) )
+                {
+                if (get_rv() <= text.length()-3)
+                    {
+                    text.erase(text.length()-3);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for four character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 4)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-4], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix4L, suffix4U) )
+                {
+                if (get_rv() <= text.length()-4)
+                    {
+                    text.erase(text.length()-4);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for five character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 5)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-5], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix5L, suffix5U) )
+                {
+                if (get_rv() <= text.length()-5)
+                    {
+                    text.erase(text.length()-5);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for six character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 6)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-6], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix6L, suffix6U) )
+                {
+                if (get_rv() <= text.length()-6)
+                    {
+                    text.erase(text.length()-6);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for seven character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 7)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-7], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-6], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix6L, suffix6U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix7L, suffix7U) )
+                {
+                if (get_rv() <= text.length()-7)
+                    {
+                    text.erase(text.length()-7);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+        //RV deletion for eight character suffix
+        inline bool delete_if_is_in_rv(string_typeT& text,
+                    const wchar_t suffix1L, const wchar_t suffix1U,
+                    const wchar_t suffix2L, const wchar_t suffix2U,
+                    const wchar_t suffix3L, const wchar_t suffix3U,
+                    const wchar_t suffix4L, const wchar_t suffix4U,
+                    const wchar_t suffix5L, const wchar_t suffix5U,
+                    const wchar_t suffix6L, const wchar_t suffix6U,
+                    const wchar_t suffix7L, const wchar_t suffix7U,
+                    const wchar_t suffix8L, const wchar_t suffix8U,
+                    const bool success_on_find = true)
+            {
+            if (text.length() < 8)
+                {
+                return false;
+                }
+            if (is_either<wchar_t>(text[text.length()-8], suffix1L, suffix1U) &&
+                is_either<wchar_t>(text[text.length()-7], suffix2L, suffix2U) &&
+                is_either<wchar_t>(text[text.length()-6], suffix3L, suffix3U) &&
+                is_either<wchar_t>(text[text.length()-5], suffix4L, suffix4U) &&
+                is_either<wchar_t>(text[text.length()-4], suffix5L, suffix5U) &&
+                is_either<wchar_t>(text[text.length()-3], suffix6L, suffix6U) &&
+                is_either<wchar_t>(text[text.length()-2], suffix7L, suffix7U) &&
+                is_either<wchar_t>(text[text.length()-1], suffix8L, suffix8U) )
+                {
+                if (get_rv() <= text.length()-8)
+                    {
+                    text.erase(text.length()-8);
+                    update_r_sections(text);
+                    return true;
+                    }
+                return success_on_find;
+                }
+            else
+                {
+                return false;
+                }
+            }
+
+        //string support functions
+        void remove_german_umlauts(string_typeT& text)
+            {
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0xC4)
+                    {
+                    text[i] = common_lang_constants::UPPER_A;
+                    }
+                else if (text[i] == 0xD6)
+                    {
+                    text[i] = common_lang_constants::UPPER_O;
+                    }
+                else if (text[i] == 0xDC)
+                    {
+                    text[i] = common_lang_constants::UPPER_U;
+                    }
+                else if (text[i] == 0xE4 )
+                    {
+                    text[i] = common_lang_constants::LOWER_A;
+                    }
+                else if (text[i] == 0xF6)
+                    {
+                    text[i] = common_lang_constants::LOWER_O;
+                    }
+                else if (text[i] == 0xFC)
+                    {
+                    text[i] = common_lang_constants::LOWER_U;
+                    }
+                }
+            }
+        void italian_acutes_to_graves(string_typeT& text)
+            {
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0xC1)//A acute
+                    {
+                    text[i] = 0xC0;
+                    }
+                else if (text[i] == 0xC9)//E acute
+                    {
+                    text[i] = 0xC8;
+                    }
+                else if (text[i] == 0xCD)//I acute
+                    {
+                    text[i] = 0xCC;
+                    }
+                else if (text[i] == 0xD3)//O acute
+                    {
+                    text[i] = 0xD2;
+                    }
+                else if (text[i] == 0xDA)//U acute
+                    {
+                    text[i] = 0xD9;
+                    }
+                else if (text[i] == 0xE1)//a acute
+                    {
+                    text[i] = 0xE0;
+                    }
+                else if (text[i] == 0xE9)//e acute
+                    {
+                    text[i] = 0xE8;
+                    }
+                else if (text[i] == 0xED)//i acute
+                    {
+                    text[i] = 0xEC;
+                    }
+                else if (text[i] == 0xF3)//o acute
+                    {
+                    text[i] = 0xF2;
+                    }
+                else if (text[i] == 0xFA)//u acute
+                    {
+                    text[i] = 0xF9;
+                    }
+                }
+            }
+        ///Hash initial y, y after a vowel, and i between vowels into hashed character.
+        //----------------------------------------------------------
+        void hash_dutch_yi(string_typeT& text,
+                    const wchar_t* vowel_string)
+            {
+            //need at least 2 letters for hashing
+            if (text.length() < 2)
+                { return; }
+
+            if (text[0] == common_lang_constants::LOWER_Y)
+                {
+                text[0] = LOWER_Y_HASH;
+                }
+            else if (text[0] == common_lang_constants::UPPER_Y)
+                {
+                text[0] = UPPER_Y_HASH;
+                }
+            bool in_vowel_block = string_util::is_one_of(text[0], vowel_string);
+
+            size_t i = 1;
+            for (i = 1; i < text.length()-1; ++i)
+                {
+                if (in_vowel_block &&
+                    text[i] == common_lang_constants::LOWER_I &&
+                    string_util::is_one_of(text[i+1], vowel_string) )
+                    {
+                    text[i] = LOWER_I_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (in_vowel_block &&
+                    text[i] == common_lang_constants::UPPER_I &&
+                    string_util::is_one_of(text[i+1], vowel_string) )
+                    {
+                    text[i] = UPPER_I_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (in_vowel_block &&
+                    text[i] == common_lang_constants::LOWER_Y)
+                    {
+                    text[i] = LOWER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (in_vowel_block &&
+                    text[i] == common_lang_constants::UPPER_Y)
+                    {
+                    text[i] = UPPER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (string_util::is_one_of(text[i], vowel_string) )
+                    {
+                    in_vowel_block = true;
+                    }
+                else
+                    {
+                    in_vowel_block = false;
+                    }
+                }
+            //check the last letter
+            if (in_vowel_block &&
+                text[i] == common_lang_constants::LOWER_Y)
+                {
+                text[i] = LOWER_Y_HASH;
+                in_vowel_block = false;
+                }
+            else if (in_vowel_block &&
+                text[i] == common_lang_constants::UPPER_Y)
+                {
+                text[i] = UPPER_Y_HASH;
+                in_vowel_block = false;
+                }
+            }
+
+        //----------------------------------------------------------
+        inline void unhash_dutch_yi(string_typeT& text)
+            {
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_Y_HASH, common_lang_constants::LOWER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_Y_HASH, common_lang_constants::UPPER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_I_HASH, common_lang_constants::LOWER_I);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_I_HASH, common_lang_constants::UPPER_I);
+            }
+
+        ///Hash 'u' and 'y' between vowels
+        //----------------------------------------------------------
+        void hash_german_yu(string_typeT& text,
+                    const wchar_t* vowel_string)
+            {
+            //need at least 2 letters for hashing
+            if (text.length() < 2)
+                { return; }
+
+            bool in_vowel_block = string_util::is_one_of(text[0], vowel_string);
+
+            for (size_t i = 1; i < text.length()-1; ++i)
+                {
+                if (in_vowel_block &&
+                    string_util::is_one_of(text[i], vowel_string) &&
+                    string_util::is_one_of(text[i+1], vowel_string) )
+                    {
+                    if (text[i] == common_lang_constants::LOWER_Y)
+                        {
+                        text[i] = LOWER_Y_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_Y)
+                        {
+                        text[i] = UPPER_Y_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::LOWER_U)
+                        {
+                        text[i] = LOWER_U_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_U)
+                        {
+                        text[i] = UPPER_U_HASH;
+                        }
+                    }
+                else if (string_util::is_one_of(text[i], vowel_string) )
+                    {
+                    in_vowel_block = true;
+                    }
+                else
+                    {
+                    in_vowel_block = false;
+                    }
+                }
+            //hashable values must be between vowels, so don't bother looking at last letter
+            }
+
+        //----------------------------------------------------------
+        inline void unhash_german_yu(string_typeT& text)
+            {
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_Y_HASH, common_lang_constants::LOWER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_Y_HASH, common_lang_constants::UPPER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_U_HASH, common_lang_constants::LOWER_U);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_U_HASH, common_lang_constants::UPPER_U);
+            }
+
+        /**Hash u or i preceded and followed by a vowel, and y preceded or followed by a vowel.
+        u after q is also hashed. For example,
+        jouer         ->         joUer
+        ennuie         ->         ennuIe
+        yeux         ->         Yeux
+        quand         ->         qUand*/
+        //----------------------------------------------------------
+        void hash_french_yui(string_typeT& text,
+                    const wchar_t* vowel_string)
+            {
+            //need at least 2 letters for hashing
+            if (text.length() < 2)
+                { return; }
+
+            bool in_vowel_block = false;
+
+            //start loop at zero because 'y' at start of string can be hashed
+            size_t i = 0;
+            for (i = 0; i < text.length()-1; ++i)
+                {
+                if (in_vowel_block &&
+                    string_util::is_one_of(text[i], vowel_string) &&
+                    string_util::is_one_of(text[i+1], vowel_string) )
+                    {
+                    if (text[i] == common_lang_constants::LOWER_Y)
+                        {
+                        text[i] = LOWER_Y_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_Y)
+                        {
+                        text[i] = UPPER_Y_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::LOWER_U)
+                        {
+                        text[i] = LOWER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_U)
+                        {
+                        text[i] = UPPER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::LOWER_I)
+                        {
+                        text[i] = LOWER_I_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_I)
+                        {
+                        text[i] = UPPER_I_HASH;
+                        in_vowel_block = false;
+                        }
+                    }
+                //if just previous letter is a vowel then examine for 'y'
+                else if (in_vowel_block &&
+                        text[i] == common_lang_constants::LOWER_Y)
+                    {
+                    text[i] = LOWER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (in_vowel_block &&
+                        text[i] == common_lang_constants::UPPER_Y)
+                    {
+                    text[i] = UPPER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                //if just following letter is a vowel then examine for 'y'
+                else if (text[i] == common_lang_constants::LOWER_Y &&
+                        string_util::is_one_of(text[i+1], vowel_string) &&
+                        is_neither<wchar_t>(text[i+1], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                    {
+                    text[i] = LOWER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (text[i] == common_lang_constants::UPPER_Y &&
+                        string_util::is_one_of(text[i+1], vowel_string) &&
+                        is_neither<wchar_t>(text[i+1], common_lang_constants::LOWER_Y, common_lang_constants::UPPER_Y) )
+                    {
+                    text[i] = UPPER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (string_util::is_one_of(text[i], vowel_string) )
+                    {
+                    if (text[i] == common_lang_constants::LOWER_U &&
+                        (i > 0) &&
+                        is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                        {
+                        text[i] = LOWER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_U &&
+                        (i > 0) &&
+                        is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                        {
+                        text[i] = UPPER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else
+                        {
+                        in_vowel_block = true;
+                        }
+                    }
+                else
+                    {
+                    in_vowel_block = false;
+                    }
+                }
+            //verify that the last letter
+            if (text[i] == common_lang_constants::LOWER_Y &&
+                (i > 0) &&
+                string_util::is_one_of(text[i-1], vowel_string)    )
+                {
+                text[i] = LOWER_Y_HASH;
+                }
+            else if (text[i] == common_lang_constants::UPPER_Y &&
+                    (i > 0) &&
+                    string_util::is_one_of(text[i-1], vowel_string) )
+                {
+                text[i] = UPPER_Y_HASH;
+                }
+            else if (text[i] == common_lang_constants::LOWER_U &&
+                    (i > 0) &&
+                    is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                {
+                text[i] = LOWER_U_HASH;
+                }
+            else if (text[i] == common_lang_constants::UPPER_U &&
+                    (i > 0) &&
+                    is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                {
+                text[i] = UPPER_U_HASH;
+                }
+            }
+
+        void unhash_french_yui(string_typeT& text)
+            {
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_Y_HASH, common_lang_constants::LOWER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_Y_HASH, common_lang_constants::UPPER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_U_HASH, common_lang_constants::LOWER_U);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_U_HASH, common_lang_constants::UPPER_U);
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_I_HASH, common_lang_constants::LOWER_I);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_I_HASH, common_lang_constants::UPPER_I);
+            }
+
+        //----------------------------------------------------------
+        void hash_y(string_typeT& text,
+                    const wchar_t* vowel_string)
+            {
+            //need at least 2 letters for hashing
+            if (text.length() < 2)
+                { return; }
+
+            //if first letter is a 'y', then it is likely not a vowel
+            if (text[0] == common_lang_constants::LOWER_Y)
+                {
+                text[0] = LOWER_Y_HASH;
+                }
+            else if (text[0] == common_lang_constants::UPPER_Y)
+                {
+                text[0] = UPPER_Y_HASH;
+                }
+
+            bool in_vowel_block = string_util::is_one_of(text[0], vowel_string);
+
+            for (size_t i = 1; i < text.length(); ++i)
+                {
+                //LOWER_Y after vowel is a consonant
+                if (in_vowel_block &&
+                    text[i] == common_lang_constants::LOWER_Y)
+                    {
+                    text[i] = LOWER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (in_vowel_block &&
+                    text[i] == common_lang_constants::UPPER_Y)
+                    {
+                    text[i] = UPPER_Y_HASH;
+                    in_vowel_block = false;
+                    }
+                else if (string_util::is_one_of(text[i], vowel_string) )
+                    {
+                    in_vowel_block = true;
+                    }
+                //we are on a consonant
+                else
+                    {
+                    in_vowel_block = false;
+                    }
+                }
+            }
+
+        //----------------------------------------------------------
+        inline void unhash_y(string_typeT& text)
+            {
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_Y_HASH, common_lang_constants::LOWER_Y);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_Y_HASH, common_lang_constants::UPPER_Y);
+            }
+
+        ///Hash u after q, and u, i between vowels
+        //----------------------------------------------------------
+        void hash_italian_ui(string_typeT& text,
+                    const wchar_t* vowel_string)
+            {
+            //need at least 2 letters for hashing
+            if (text.length() < 2)
+                { return; }
+
+            bool in_vowel_block = string_util::is_one_of(text[0], vowel_string);
+
+            size_t i = 1;
+            for (i = 1; i < text.length()-1; ++i)
+                {
+                if (in_vowel_block &&
+                    string_util::is_one_of(text[i], vowel_string) &&
+                    string_util::is_one_of(text[i+1], vowel_string) )
+                    {
+                    if (text[i] == common_lang_constants::LOWER_I )
+                        {
+                        text[i] = LOWER_I_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_I )
+                        {
+                        text[i] = UPPER_I_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::LOWER_U)
+                        {
+                        text[i] = LOWER_U_HASH;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_U)
+                        {
+                        text[i] = UPPER_U_HASH;
+                        }
+                    }
+                else if (string_util::is_one_of(text[i], vowel_string) )
+                    {
+                    /*u after q should be encrypted and not be
+                    treated as a vowel*/
+                    if (text[i] == common_lang_constants::LOWER_U &&
+                        (i > 0) &&
+                        is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                        {
+                        text[i] = LOWER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else if (text[i] == common_lang_constants::UPPER_U &&
+                        (i > 0) &&
+                        is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                        {
+                        text[i] = UPPER_U_HASH;
+                        in_vowel_block = false;
+                        }
+                    else
+                        {
+                        in_vowel_block = true;
+                        }
+                    }
+                //we are on a consonant
+                else
+                    {
+                    in_vowel_block = false;
+                    }
+                }
+            //verify the last letter
+            if (text[i] == common_lang_constants::LOWER_U &&
+                (i > 0) &&
+                is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                {
+                text[i] = LOWER_U_HASH;
+                }
+            else if (text[i] == common_lang_constants::UPPER_U &&
+                (i > 0) &&
+                is_either<wchar_t>(text[i-1], common_lang_constants::LOWER_Q, common_lang_constants::UPPER_Q) )
+                {
+                text[i] = UPPER_U_HASH;
+                }
+            }
+
+        //----------------------------------------------------------
+        inline void unhash_italian_ui(string_typeT& text)
+            {
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_I_HASH, common_lang_constants::LOWER_I);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_I_HASH, common_lang_constants::UPPER_I);
+            string_util::replace_all<wchar_t, string_typeT >(text, LOWER_U_HASH, common_lang_constants::LOWER_U);
+            string_util::replace_all<wchar_t, string_typeT >(text, UPPER_U_HASH, common_lang_constants::UPPER_U);
+            }
+
+        //----------------------------------------------------------
+        void remove_dutch_umlauts(string_typeT& text)
+            {
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0xC4)
+                    {
+                    text[i] = common_lang_constants::UPPER_A;
+                    }
+                else if (text[i] == 0xCB)
+                    {
+                    text[i] = common_lang_constants::UPPER_E;
+                    }
+                else if (text[i] == 0xCF)
+                    {
+                    text[i] = common_lang_constants::UPPER_I;
+                    }
+                else if (text[i] == 0xD6)
+                    {
+                    text[i] = common_lang_constants::UPPER_O;
+                    }
+                else if (text[i] == 0xDC)
+                    {
+                    text[i] = common_lang_constants::UPPER_U;
+                    }
+                else if (text[i] == 0xE4)
+                    {
+                    text[i] = common_lang_constants::LOWER_A;
+                    }
+                else if (text[i] == 0xEB)
+                    {
+                    text[i] = common_lang_constants::LOWER_E;
+                    }
+                else if (text[i] == 0xEF)
+                    {
+                    text[i] = common_lang_constants::LOWER_I;
+                    }
+                else if (text[i] == 0xF6)
+                    {
+                    text[i] = common_lang_constants::LOWER_O;
+                    }
+                else if (text[i] == 0xFC)
+                    {
+                    text[i] = common_lang_constants::LOWER_U;
+                    }
+                }
+            }
+
+        //----------------------------------------------------------
+        void remove_dutch_acutes(string_typeT& text)
+            {
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0xC1)
+                    {
+                    text[i] = common_lang_constants::UPPER_A;
+                    }
+                else if (text[i] == 0xC9)
+                    {
+                    text[i] = common_lang_constants::UPPER_E;
+                    }
+                else if (text[i] == 0xCD)
+                    {
+                    text[i] = common_lang_constants::UPPER_I;
+                    }
+                else if (text[i] == 0xD3)
+                    {
+                    text[i] = common_lang_constants::UPPER_O;
+                    }
+                else if (text[i] == 0xDA)
+                    {
+                    text[i] = common_lang_constants::UPPER_U;
+                    }
+                else if (text[i] == 0xE1)
+                    {
+                    text[i] = common_lang_constants::LOWER_A;
+                    }
+                else if (text[i] == 0xE9)
+                    {
+                    text[i] = common_lang_constants::LOWER_E;
+                    }
+                else if (text[i] == 0xED)
+                    {
+                    text[i] = common_lang_constants::LOWER_I;
+                    }
+                else if (text[i] == 0xF3)
+                    {
+                    text[i] = common_lang_constants::LOWER_O;
+                    }
+                else if (text[i] == 0xFA)
+                    {
+                    text[i] = common_lang_constants::LOWER_U;
+                    }
+                }
+            }
+
+        //----------------------------------------------------------
+        void remove_spanish_acutes(string_typeT& text)
+            {
+            for (size_t i = 0; i < text.length(); ++i)
+                {
+                if (text[i] == 0xC1)
+                    {
+                    text[i] = common_lang_constants::UPPER_A;
+                    }
+                else if (text[i] == 0xC9)
+                    {
+                    text[i] = common_lang_constants::UPPER_E;
+                    }
+                else if (text[i] == 0xCD)
+                    {
+                    text[i] = common_lang_constants::UPPER_I;
+                    }
+                else if (text[i] == 0xD3)
+                    {
+                    text[i] = common_lang_constants::UPPER_O;
+                    }
+                else if (text[i] == 0xDA)
+                    {
+                    text[i] = common_lang_constants::UPPER_U;
+                    }
+                else if (text[i] == 0xE1)
+                    {
+                    text[i] = common_lang_constants::LOWER_A;
+                    }
+                else if (text[i] == 0xE9)
+                    {
+                    text[i] = common_lang_constants::LOWER_E;
+                    }
+                else if (text[i] == 0xED)
+                    {
+                    text[i] = common_lang_constants::LOWER_I;
+                    }
+                else if (text[i] == 0xF3)
+                    {
+                    text[i] = common_lang_constants::LOWER_O;
+                    }
+                else if (text[i] == 0xFA)
+                    {
+                    text[i] = common_lang_constants::LOWER_U;
+                    }
+                }
+            }
+
+        inline size_t get_r1() const
+            { return m_r1; }
+        inline void set_r1(const size_t val)
+            { m_r1 = val; }
+
+        inline size_t get_r2() const
+            { return m_r2; }
+        inline void set_r2(const size_t val)
+            { m_r2 = val; }
+
+        inline size_t get_rv() const
+            { return m_rv; }
+        inline void set_rv(const size_t val)
+            { m_rv = val; }
+
+        void reset_r_values()
+            { m_r1 = m_r2 = m_rv = 0; }
+    private:
+        size_t m_r1;
+        size_t m_r2;
+        //only used for romance/russian languages
+        size_t m_rv;
+        };
+
+    //------------------------------------------------------
+    /*A non-operational stemmer that is used in place of regular stemmers when
+    you don't want the system to actually stem anything.*/
+    template <typename string_typeT = std::wstring>
+    class no_op_stem
+        {
+    public:
+        ///No-op stemming of declared string type
+        inline void operator()(const string_typeT&) const
+            {}
+        ///No-op stemming of flexible string type
+        template <typename T>
+        inline void operator()(const T&) const
+            {}
+        };
+    }
+
+#endif //__STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/stemming/swedish_stem.h b/third-party/include/OleanderStemmingLibrary/stemming/swedish_stem.h
new file mode 100644 (file)
index 0000000..9e6d5e4
--- /dev/null
@@ -0,0 +1,330 @@
+/**
+\date 2004-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __SWEDISH_STEM_H__
+#define __SWEDISH_STEM_H__
+
+#include "stemming.h"
+
+namespace stemming
+    {
+    /** \addtogroup Stemming
+    * @{*/
+    /**
+    \class swedish_stem
+        Swedish stemming class.
+
+    The Swedish alphabet includes the following additional letters,
+        - ä   å   ö
+
+    The following letters are vowels:
+        - a   e   i   o   u   y   ä   å   ö
+
+    R2 is not used: R1 is defined in the same way as in the German stemmer.
+
+    Define a valid s-ending as one of:
+        - b c d f g h j k l m n o p r t v y
+    
+    \par Algorithm:
+
+    <b>Step 1:</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated.
+        - a   arna   erna   heterna   orna   ad   e   ade   ande   arne   are   aste   en   anden
+              aren   heten   ern   ar   er   heter   or   as   arnas   ernas   ornas   es   ades
+              andes   ens   arens   hetens   erns   at   andet   het   ast
+            - Delete.
+        - s
+         - Delete if preceded by a valid s-ending.
+
+    (Of course the letter of the valid s-ending is not necessarily in R1).
+
+    <b>Step 2:</b>
+
+    Search for one of the following suffixes in R1, and if found delete the last letter. 
+        - dd   gd   nn   dt   gt   kt   tt 
+
+    (For example, friskt -> frisk, fröknarnn -> fröknarn).
+    
+    <b>Step 2:</b>
+
+    Search for the longest among the following suffixes in R1, and perform the action indicated.
+        - lig   ig   els 
+            - Delete 
+        - löst 
+            - Replace with lös 
+        - fullt 
+            - Replace with full
+    */
+    //------------------------------------------------------
+    template <typename string_typeT = std::wstring>
+    class swedish_stem : public stem<string_typeT>
+        {
+    public:
+        //---------------------------------------------
+        /**@param text string to stem*/
+        void operator()(string_typeT& text)
+            {
+            if (text.length() < 3)
+                {
+                return;
+                }
+
+            //reset internal data
+            stem<string_typeT>::reset_r_values();
+
+            stem<string_typeT>::trim_western_punctuation(text);
+
+            //see where the R1 section begins
+            //R1 is the first consonant after the first vowel
+            stem<string_typeT>::find_r1(text, SWEDISH_VOWELS);
+            if (stem<string_typeT>::get_r1() == text.length())
+                {
+                return;
+                }
+
+            //R1 must have at least 3 characters in front of it
+            if (stem<string_typeT>::get_r1() < 3)
+                {
+                stem<string_typeT>::set_r1(3);    
+                }
+            //swedish does not use R2
+
+            step_1(text);
+            step_2(text);
+            step_3(text);
+            }
+    private:
+        //---------------------------------------------
+        void step_1(string_typeT& text)
+            {
+            if (stem<string_typeT>::delete_if_is_in_r1(text,/*heterna*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*hetens*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*arna*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*erna*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*orna*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }    
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ande*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*arne*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*aste*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*anden*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heten*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*heter*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*arnas*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ernas*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ornas*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*arens*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*andet*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*andes*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*aren*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, /*erns*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ades*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*are*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ade*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*het*/common_lang_constants::LOWER_H, common_lang_constants::UPPER_H, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ast*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, /*ens*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ern*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*at*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*es*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*or*/common_lang_constants::LOWER_O, common_lang_constants::UPPER_O, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ad*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*as*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ar*/common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*er*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_R, common_lang_constants::UPPER_R, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*en*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_A, common_lang_constants::UPPER_A, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text, common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S) )
+                {
+                if (text.length() >= 2 &&
+                    string_util::is_one_of(text[text.length()-2],
+                    L"bcdfghjklmnoprtvyBCDFGHJKLMNOPRTVY") )
+                    {
+                    text.erase(text.length()-1);
+                    stem<string_typeT>::update_r_sections(text);
+                    }
+                return;
+                }
+            }
+        //---------------------------------------------
+        void step_2(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*dd*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*gd*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_D, common_lang_constants::UPPER_D) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*nn*/common_lang_constants::LOWER_N, common_lang_constants::UPPER_N, common_lang_constants::LOWER_N, common_lang_constants::UPPER_N) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*dt*/common_lang_constants::LOWER_D, common_lang_constants::UPPER_D, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*gt*/common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*kt*/common_lang_constants::LOWER_K, common_lang_constants::UPPER_K, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*tt*/common_lang_constants::LOWER_T, common_lang_constants::UPPER_T, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            }
+        //---------------------------------------------
+        void step_3(string_typeT& text)
+            {
+            if (stem<string_typeT>::is_suffix_in_r1(text,/*fullt*/common_lang_constants::LOWER_F, common_lang_constants::UPPER_F, common_lang_constants::LOWER_U, common_lang_constants::UPPER_U, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::is_suffix_in_r1(text,/*löst*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_O_UMLAUTS, common_lang_constants::UPPER_O_UMLAUTS, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, common_lang_constants::LOWER_T, common_lang_constants::UPPER_T) )
+                {
+                text.erase(text.length()-1);
+                stem<string_typeT>::update_r_sections(text);
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*lig*/common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*els*/common_lang_constants::LOWER_E, common_lang_constants::UPPER_E, common_lang_constants::LOWER_L, common_lang_constants::UPPER_L, common_lang_constants::LOWER_S, common_lang_constants::UPPER_S, false) )
+                {
+                return;
+                }
+            else if (stem<string_typeT>::delete_if_is_in_r1(text,/*ig*/common_lang_constants::LOWER_I, common_lang_constants::UPPER_I, common_lang_constants::LOWER_G, common_lang_constants::UPPER_G, false) )
+                {
+                return;
+                }
+            }
+        };
+    }
+
+#endif //__SWEDISH_STEM_H__
diff --git a/third-party/include/OleanderStemmingLibrary/utilities/debug_logic.h b/third-party/include/OleanderStemmingLibrary/utilities/debug_logic.h
new file mode 100644 (file)
index 0000000..5ab19f1
--- /dev/null
@@ -0,0 +1,79 @@
+/**
+\date 2008-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __DEBUG_LOGIC_H__
+#define __DEBUG_LOGIC_H__
+
+#include <iostream>
+#include <fstream>
+#include <iterator>
+
+/** \addtogroup Debugging
+   * Functions used for debugging.
+   * @{*/
+/**
+\def __DEBUG_FUNCTION_NAME__
+    Expands to the name of the current function. Will not be defined if
+    compiler does not have a native function name macro.
+\def CASSERT(expression)
+    Validates that an expression is true at compile time. If the expression is false
+    then compilation will fail.
+\def NON_UNIT_TEST_ASSERT(expression)
+    If unit test symbol (__UNITTEST) is defined then does nothing; otherwise asserts.
+    This is useful for suppressing asserts when unit testing.
+\def DUMP_TO_FILE(stream,file)
+    Prints data stream to a specified file.*/
+/** @} */
+
+#ifdef __PRETTY_FUNCTION__
+    #define __DEBUG_FUNCTION_NAME__ __PRETTY_FUNCTION__
+#elif defined(__FUNCTION__)
+    #define __DEBUG_FUNCTION_NAME__ __FUNCTION__
+#elif defined(__func__)
+    #define __DEBUG_FUNCTION_NAME__ __func__
+#elif defined(__FUNCSIG__)
+    #define __DEBUG_FUNCTION_NAME__ __FUNCSIG__
+#elif defined(__FUNCDNAME__)
+    #define __DEBUG_FUNCTION_NAME__ __FUNCDNAME__
+#endif
+
+//----------------------------------------------------------------------
+#if !defined (NDEBUG) || defined ENABLE_LOGIC_CHECKS || defined DEBUG_ENABLE_ALL
+    #define CASSERT(x) typedef char __C_ASSERT__[(x) ? 1 : -1]
+#else
+    #define CASSERT(x) ((void)0)
+#endif
+
+//----------------------------------------------------------------------
+#ifdef __UNITTEST
+    #define NON_UNIT_TEST_ASSERT(x) ((void)0)
+#else
+    #define NON_UNIT_TEST_ASSERT(x) assert(x)
+#endif
+
+//----------------------------------------------------------------------
+#if !defined (NDEBUG) || defined DEBUG_ENABLE_ALL
+    #define DUMP_TO_FILE(x,file) __debug::__dump_to_file((x), (file))
+#else
+    #define DUMP_TO_FILE(x,file) ((void)0)
+#endif
+
+//----------------------------------------------------------------------
+namespace __debug
+    {
+    //debug helpers
+    inline void __dump_to_file(const wchar_t* begin, const std::string& file_path)
+        {
+        if (begin == NULL)
+            { return; }
+        std::wofstream f(file_path.c_str());
+        f.write(begin, static_cast<std::streamsize>(std::wcslen(begin)));
+        }
+    }
+
+#endif //__DEBUG_LOGIC_H__
diff --git a/third-party/include/OleanderStemmingLibrary/utilities/safe_math.h b/third-party/include/OleanderStemmingLibrary/utilities/safe_math.h
new file mode 100644 (file)
index 0000000..87acba1
--- /dev/null
@@ -0,0 +1,117 @@
+/** \addtogroup Mathematics
+   * Math and statistics classes.
+* @{*/
+/**
+\date 2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __SAFE_MATH_H__
+#define __SAFE_MATH_H__
+
+#include <cmath>
+#include <cassert>
+#include <functional>
+
+//DIVISION OPERATIONS
+//-------------------
+
+///Modulus operation that checks for modulus by zero or into zero (returns zero for those situations).
+///@param dividend The dividend (i.e., the value being divided).
+///@param divisor The divisor (i.e., the value dividing by).
+///@returns The remainder of the modulus operation, or zero if one of the values was invalid.
+template<typename T>
+inline T safe_modulus(const T dividend, const T divisor)
+    {
+    if (dividend == 0 || divisor == 0)
+        { return 0; }
+    return dividend%divisor;
+    }
+
+///Division operation that checks for division by zero or into zero (returns zero for those situations).
+///@param dividend The dividend (i.e., the value being divided).
+///@param divisor The divisor (i.e., the value dividing by).
+///@returns The quotient of the division operation, or zero if one of the values was invalid.
+///@note If the template type has a floating point precision, then the result will retain its precision.
+template<typename T>
+inline T safe_divide(const T dividend, const T divisor)
+    {
+    if (dividend == 0 || divisor == 0)
+        { return 0; }
+    return dividend/static_cast<T>(divisor);
+    }
+
+//DOUBLE OPERATIONS
+//-----------------
+
+/**Compares two double values (given the specified precision).
+   @param actual The value being reviewed.
+   @param expected The expected value to compare against.
+   @param delta The tolerance of how different the values can be. The larger the delta, the
+   higher precision used in the comparison.
+   @returns True if the value matches the expected value.*/
+inline bool compare_doubles(const double actual, const double expected, const double delta = 1e-6)
+    {
+    assert(delta >= 0 && "delta value should be positive when comparing doubles");
+    return (std::fabs(actual-expected) <= std::fabs(delta));
+    }
+
+/**Compares two double values for less than (given the specified precision).
+   @param left The value being reviewed.
+   @param right The other value to compare against.
+   @param delta The tolerance of how different the values can be. The larger the delta, the
+   higher precision used in the comparison.
+   @returns True if the value is less than the other value.*/
+inline bool compare_doubles_less(const double left, const double right, const double delta = 1e-6)
+    {
+    assert(delta >= 0 && "delta value should be positive when comparing doubles");
+       return std::fabs(left-right) > std::fabs(delta) && (left < right);
+    }
+
+/**Compares two double values for less than or equal to (given the specified precision).
+   @param left The value being reviewed.
+   @param right The other value to compare against.
+   @param delta The tolerance of how different the values can be. The larger the delta, the
+   higher precision used in the comparison.
+   @returns True if the value is less than or equal to the other value.*/
+inline bool compare_doubles_less_or_equal(const double left, const double right, const double delta = 1e-6)
+    {
+    assert(delta >= 0 && "delta value should be positive when comparing doubles");
+       return compare_doubles_less(left,right,delta) || compare_doubles(left,right,delta);
+    }
+
+/**Compares two double values for greater than (given the specified precision).
+   @param left The value being reviewed.
+   @param right The other value to compare against.
+   @param delta The tolerance of how different the values can be. The larger the delta, the
+   higher precision used in the comparison.
+   @returns True if the value is greater than the other value.*/
+inline bool compare_doubles_greater(const double left, const double right, const double delta = 1e-6)
+    {
+    assert(delta >= 0 && "delta value should be positive when comparing doubles");
+       return std::fabs(left-right) > std::fabs(delta) && (left > right);
+    }
+
+///"less" interface for double values.
+class double_less : public std::binary_function<double, double, bool>
+    {
+public:
+    inline bool operator()(const double& left, const double& right) const
+        { return compare_doubles_less(left,right); }
+    };
+
+//INTEGER OPERATIONS
+//------------------
+
+///Converts an integral type to a boolean. Compilers complain about directly assigning
+///an int to a bool (casting doesn't help either), so this works around that.
+///@param intVal The integer value to convert to a boolean.
+///@returns The boolean equivalent of the integer.
+template<typename T>
+inline bool int_to_bool(const T intVal)
+    { return (intVal != 0); }
+
+#endif //__SAFE_MATH_H__
diff --git a/third-party/include/OleanderStemmingLibrary/utilities/utilities.h b/third-party/include/OleanderStemmingLibrary/utilities/utilities.h
new file mode 100644 (file)
index 0000000..8424026
--- /dev/null
@@ -0,0 +1,156 @@
+/**
+\date 2003-2015
+\copyright Oleander Software, Ltd.
+\author Oleander Software, Ltd.
+\details This program is free software; you can redistribute it and/or modify
+it under the terms of the BSD License.
+*/
+
+#ifndef __UTILITIES_H__
+#define __UTILITIES_H__
+
+#include <algorithm>
+#include <functional>
+#include <cmath>
+#include <cassert>
+
+///@returns the item count of an array.
+#define size_of_array(x) (sizeof(x)/sizeof(x[0]))
+
+/**Range checks a given value and truncates it if it is too high or low.
+   @param start The start of the valid range.
+   @param end The end of the valid range.
+   @param value The value to be range checked.
+   @returns The value if within the valid range. If it was too large, then the end of the range
+   is returned. If too low, then the start of the range is returned.*/
+template<typename T>
+inline T within_range(const T start, const T end, const T value)
+    {
+    return ( (value >= start) && (value <= end) ) ? value :
+            (value < start) ? start :
+            (value > end) ? end : /*never reaches this branch*/ value;
+    }
+
+///pair interface that compares on the first item
+template<typename T1, typename T2>
+class comparable_first_pair : public std::pair<T1,T2>
+    {
+public:
+    comparable_first_pair() : std::pair<T1,T2>() {}
+    comparable_first_pair(const T1& t1, const T2& t2) : std::pair<T1,T2>(t1,t2) {}
+    bool operator<(const comparable_first_pair<T1,T2>& that) const
+        { return std::pair<T1,T2>::first < that.first; }
+    bool operator==(const comparable_first_pair<T1,T2>& that) const
+        { return std::pair<T1,T2>::first == that.first; }
+    };
+
+///class that remembers its original value from construction.
+template <typename T>
+class backup_variable
+    {
+public:
+    backup_variable(const T& value) : m_originalValue(value), m_value(value)
+        {}
+    void operator=(const T& value)
+        { m_value = value; }
+    bool operator==(const T& value) const
+        { return m_value == value; }
+    bool operator<(const T& value) const
+        { return m_value < value; }
+    bool operator<=(const T& value) const
+        { return m_value <= value; }
+    bool operator>(const T& value) const
+        { return m_value > value; }
+    bool operator>=(const T& value) const
+        { return m_value >= value; }
+    void operator+(const T& value)
+        { m_value + value; }
+    void operator+=(const T& value)
+        { m_value += value; }
+    void operator-(const T& value)
+        { m_value - value; }
+    void operator-=(const T& value)
+        { m_value -= value; }
+    operator const T() const
+        { return m_value; }
+    T* operator&()
+        { return &m_value; }
+    const T& get_value() const
+        { return m_value; }
+    T& get_value()
+        { return m_value; }
+    bool has_changed() const
+        { return m_value != m_originalValue; }
+private:
+    T m_originalValue;
+    T m_value;
+    };
+
+///Determines if a given value is either of two other given values
+template<typename T>
+inline bool is_either(const T value, const T first, const T second)
+    {
+    return (value == first || value == second);
+    }
+
+///Determines if a given value is neither of two other given values
+template<typename T>
+inline bool is_neither(const T value, const T first, const T second)
+    {
+    assert(first != second);
+    return (value != first && value != second);
+    }
+
+///determines if a value is within a given range
+template<typename T>
+inline bool is_within(const T value, const T first, const T second)
+    {
+    assert(first <= second);
+    return (value >= first && value <= second);
+    }
+
+/**calls a member function of elements in a container for each
+element in another container*/
+template<typename inT, typename outT, typename member_extract_functorT>
+inline outT copy_member(inT begin, inT end, outT dest, member_extract_functorT get_value)
+    {
+    for (; begin != end; ++dest, ++begin)
+        *dest = get_value(*begin);
+    return (dest);
+    }
+
+///Copies a member value between objects based on specified criteria
+template<typename inT, typename outT,
+         typename _Pr,
+         typename member_extract_functorT>
+inline outT copy_member_if(inT begin, inT end, outT dest,
+                           _Pr meets_criteria,
+                           member_extract_functorT get_value)
+    {
+    for (; begin != end; ++begin)
+        {
+        if (meets_criteria(*begin))
+            {
+            *dest = get_value(*begin);
+            ++dest;
+            }
+        }
+    return (dest);
+    }
+
+///determines if a value is within a given range
+template<typename T>
+class within : public std::unary_function<T, bool>
+    {
+public:
+    within(T range_begin, T range_end)
+        : m_range_begin(range_begin), m_range_end(range_end)
+        {}
+    inline bool operator()(T value) const
+        { return is_within(value, m_range_begin, m_range_end); }
+private:
+    T m_range_begin;
+    T m_range_end;
+    };
+
+#endif //__UTILITIES_H__
diff --git a/third-party/license/OleanderStemmingLibrary/license.txt b/third-party/license/OleanderStemmingLibrary/license.txt
new file mode 100644 (file)
index 0000000..92648dc
--- /dev/null
@@ -0,0 +1,11 @@
+Oleander Stemming Library
+Copyright (c) 2015, Oleander Software, Ltd.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the name of Oleander Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/third-party/license/gnome-icon-theme-3.12.0/AUTHORS b/third-party/license/gnome-icon-theme-3.12.0/AUTHORS
new file mode 100644 (file)
index 0000000..bf53816
--- /dev/null
@@ -0,0 +1,15 @@
+Ulisse Perusin <uli.peru@gmail.com>
+Riccardo Buzzotta <raozuzu@yahoo.it>
+Josef Vybíral <cornelius@vybiral.info>
+Hylke Bons <h.bons@gmail.com>
+Ricardo González <rick@jinlabs.com>
+Lapo Calamandrei <calamandrei@gmail.com>
+Rodney Dawes <dobey@novell.com>
+Luca Ferretti <elle.uca@libero.it>
+Tuomas Kuosmanen <tigert@gimp.org>
+Andreas Nilsson <nisses.mail@home.se>
+Jakub Steiner <jimmac@novell.com>
+
+Some external 3D Assets used:
+Geraldo Cockerhan - http://www.blendswap.com/blends/view/40495 CCBYSA
+
diff --git a/third-party/license/gnome-icon-theme-3.12.0/COPYING b/third-party/license/gnome-icon-theme-3.12.0/COPYING
new file mode 100644 (file)
index 0000000..294a029
--- /dev/null
@@ -0,0 +1 @@
+GNOME icon theme is distributed under the terms of either GNU LGPL v.3 or Creative Commons BY-SA 3.0 license.
diff --git a/third-party/license/gnome-icon-theme-3.12.0/COPYING_CCBYSA3 b/third-party/license/gnome-icon-theme-3.12.0/COPYING_CCBYSA3
new file mode 100644 (file)
index 0000000..fc45d78
--- /dev/null
@@ -0,0 +1,7 @@
+This work is licenced under the Creative Commons Attribution-Share Alike 3.0
+United States License. To view a copy of this licence, visit
+http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
+Commons, 171 Second Street, Suite 300, San Francisco, California 94105, USA.
+
+When attributing the artwork, using "GNOME Project" is enough. 
+Please link to http://www.gnome.org where available.
diff --git a/third-party/license/gnome-icon-theme-3.12.0/COPYING_LGPL b/third-party/license/gnome-icon-theme-3.12.0/COPYING_LGPL
new file mode 100644 (file)
index 0000000..65c5ca8
--- /dev/null
@@ -0,0 +1,165 @@
+                   GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions.
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version.
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/third-party/license/mecab-0.996/AUTHORS b/third-party/license/mecab-0.996/AUTHORS
new file mode 100644 (file)
index 0000000..a44e82c
--- /dev/null
@@ -0,0 +1 @@
+Taku Kudo <taku@chasen.org>
diff --git a/third-party/license/mecab-0.996/BSD b/third-party/license/mecab-0.996/BSD
new file mode 100644 (file)
index 0000000..9ae6ded
--- /dev/null
@@ -0,0 +1,29 @@
+Copyright (c) 2001-2008, Taku Kudo
+Copyright (c) 2004-2008, Nippon Telegraph and Telephone Corporation
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are
+permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above
+   copyright notice, this list of conditions and the
+   following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+   copyright notice, this list of conditions and the
+   following disclaimer in the documentation and/or other
+   materials provided with the distribution.
+
+ * Neither the name of the Nippon Telegraph and Telegraph Corporation
+   nor the names of its contributors may be used to endorse or
+   promote products derived from this software without specific
+   prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/third-party/license/mecab-0.996/COPYING b/third-party/license/mecab-0.996/COPYING
new file mode 100644 (file)
index 0000000..326b101
--- /dev/null
@@ -0,0 +1,4 @@
+MeCab is copyrighted free software by Taku Kudo <taku@chasen.org> and
+Nippon Telegraph and Telephone Corporation, and is released under
+any of the GPL (see the file GPL), the LGPL (see the file LGPL), or the
+BSD License (see the file BSD).
diff --git a/third-party/license/mecab-0.996/GPL b/third-party/license/mecab-0.996/GPL
new file mode 100644 (file)
index 0000000..5b6e7c6
--- /dev/null
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/third-party/license/mecab-0.996/LGPL b/third-party/license/mecab-0.996/LGPL
new file mode 100644 (file)
index 0000000..223ede7
--- /dev/null
@@ -0,0 +1,504 @@
+                 GNU LESSER GENERAL PUBLIC LICENSE
+                      Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+                 GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+\f
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                           NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/third-party/license/mecab-ipadic-2.7.0-20070801/AUTHORS b/third-party/license/mecab-ipadic-2.7.0-20070801/AUTHORS
new file mode 100644 (file)
index 0000000..995f5c2
--- /dev/null
@@ -0,0 +1,6 @@
+Taku Kudo <taku@chasen.org>
+chasen@is.aist-nara.ac.jp
+
+Masayuki Asahara:masayu-a@is.aist-nara.ac.jp
+Yuji Matsumoto:matsu@is.aist-nara.ac.jp
+
diff --git a/third-party/license/mecab-ipadic-2.7.0-20070801/COPYING b/third-party/license/mecab-ipadic-2.7.0-20070801/COPYING
new file mode 100644 (file)
index 0000000..dc7db62
--- /dev/null
@@ -0,0 +1,71 @@
+Copyright 2000, 2001, 2002, 2003 Nara Institute of Science
+and Technology.  All Rights Reserved.
+
+Use, reproduction, and distribution of this software is permitted.
+Any copy of this software, whether in its original form or modified,
+must include both the above copyright notice and the following
+paragraphs.
+
+Nara Institute of Science and Technology (NAIST),
+the copyright holders, disclaims all warranties with regard to this
+software, including all implied warranties of merchantability and
+fitness, in no event shall NAIST be liable for
+any special, indirect or consequential damages or any damages
+whatsoever resulting from loss of use, data or profits, whether in an
+action of contract, negligence or other tortuous action, arising out
+of or in connection with the use or performance of this software.
+
+A large portion of the dictionary entries
+originate from ICOT Free Software.  The following conditions for ICOT
+Free Software applies to the current dictionary as well.
+
+Each User may also freely distribute the Program, whether in its
+original form or modified, to any third party or parties, PROVIDED
+that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
+on, or be attached to, the Program, which is distributed substantially
+in the same form as set out herein and that such intended
+distribution, if actually made, will neither violate or otherwise
+contravene any of the laws and regulations of the countries having
+jurisdiction over the User or the intended distribution itself.
+
+NO WARRANTY
+
+The program was produced on an experimental basis in the course of the
+research and development conducted during the project and is provided
+to users as so produced on an experimental basis.  Accordingly, the
+program is provided without any warranty whatsoever, whether express,
+implied, statutory or otherwise.  The term "warranty" used herein
+includes, but is not limited to, any warranty of the quality,
+performance, merchantability and fitness for a particular purpose of
+the program and the nonexistence of any infringement or violation of
+any right of any third party.
+
+Each user of the program will agree and understand, and be deemed to
+have agreed and understood, that there is no warranty whatsoever for
+the program and, accordingly, the entire risk arising from or
+otherwise connected with the program is assumed by the user.
+
+Therefore, neither ICOT, the copyright holder, or any other
+organization that participated in or was otherwise related to the
+development of the program and their respective officials, directors,
+officers and other employees shall be held liable for any and all
+damages, including, without limitation, general, special, incidental
+and consequential damages, arising out of or otherwise in connection
+with the use or inability to use the program or any product, material
+or result produced or otherwise obtained by using the program,
+regardless of whether they have been advised of, or otherwise had
+knowledge of, the possibility of such damages at any time during the
+project or thereafter.  Each user will be deemed to have agreed to the
+foregoing by his or her commencement of use of the program.  The term
+"use" as used herein includes, but is not limited to, the use,
+modification, copying and distribution of the program and the
+production of secondary products from the program.
+
+In the case where the program, whether in its original form or
+modified, was distributed or delivered to or received by a user from
+any person, organization or entity other than ICOT, unless it makes or
+grants independently of ICOT any specific warranty to the user in
+writing, such person, organization or entity, will also be exempted
+from and not be held liable to the user for any such damages as noted
+above as far as the program is concerned.
+÷÷
diff --git a/third-party/license/openssl-1.0.2d/ACKNOWLEDGMENTS b/third-party/license/openssl-1.0.2d/ACKNOWLEDGMENTS
new file mode 100644 (file)
index 0000000..59c6f01
--- /dev/null
@@ -0,0 +1,30 @@
+The OpenSSL project depends on volunteer efforts and financial support from
+the end user community. That support comes in the form of donations and paid
+sponsorships, software support contracts, paid consulting services
+and commissioned software development.
+
+Since all these activities support the continued development and improvement
+of OpenSSL we consider all these clients and customers as sponsors of the
+OpenSSL project.
+
+We would like to identify and thank the following such sponsors for their past
+or current significant support of the OpenSSL project:
+
+Major support:
+
+       Qualys          http://www.qualys.com/
+
+Very significant support:
+
+       OpenGear:       http://www.opengear.com/
+
+Significant support:
+
+       PSW Group:      http://www.psw.net/
+       Acano Ltd.      http://acano.com/
+
+Please note that we ask permission to identify sponsors and that some sponsors
+we consider eligible for inclusion here have requested to remain anonymous.
+
+Additional sponsorship or financial support is always welcome: for more
+information please contact the OpenSSL Software Foundation.
diff --git a/third-party/license/openssl-1.0.2d/LICENSE b/third-party/license/openssl-1.0.2d/LICENSE
new file mode 100644 (file)
index 0000000..e47d101
--- /dev/null
@@ -0,0 +1,127 @@
+
+  LICENSE ISSUES
+  ==============
+
+  The OpenSSL toolkit stays under a dual license, i.e. both the conditions of
+  the OpenSSL License and the original SSLeay license apply to the toolkit.
+  See below for the actual license texts. Actually both licenses are BSD-style
+  Open Source licenses. In case of any license issues related to OpenSSL
+  please contact openssl-core@openssl.org.
+
+  OpenSSL License
+  ---------------
+
+/* ====================================================================
+ * Copyright (c) 1998-2011 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer. 
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com).  This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+ Original SSLeay License
+ -----------------------
+
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ * 
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to.  The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ * 
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *    "This product includes cryptographic software written by
+ *     Eric Young (eay@cryptsoft.com)"
+ *    The word 'cryptographic' can be left out if the rouines from the library
+ *    being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from 
+ *    the apps directory (application code) you must include an acknowledgement:
+ *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ * 
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * 
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed.  i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+
diff --git a/third-party/license/sodipodi-flags/COPYING b/third-party/license/sodipodi-flags/COPYING
new file mode 100644 (file)
index 0000000..3d1ad8b
--- /dev/null
@@ -0,0 +1 @@
+The flags in this collection is available in the Public Domain. For details check out either the HTML or txt file in the License directory.
diff --git a/third-party/license/sodipodi-flags/CREDITS b/third-party/license/sodipodi-flags/CREDITS
new file mode 100644 (file)
index 0000000..82edfdf
--- /dev/null
@@ -0,0 +1,139 @@
+Serbia, Serbia & Monte Negro   Nikola Pizurica
+Yugoslavia                     Nikola Pizurica
+East Germany, Nepal, UN, Tibet Tobias Jakobs                   tobias.jakobs(at)web.de
+San Marino, Papa New Guinea    Tobias Jakobs                   tobias.jakobs(at)web.de
+Samoa, Sudan, Sri Lanka                Tobias Jakobs                   tobias.jakobs(at)web.de
+Lebanon, Kuwait, Congo, Lebanon        Tobias Jakobs                   tobias.jakobs(at)web.de
+Bhutan, Uganda, Mozambique     Tobias Jakobs                   tobias.jakobs(at)web.de
+Central African Republic       Tobias Jakobs                   tobias.jakobs(at)web.de
+Zambia, Zimbawe, Antartica     Tobias Jakobs                   tobias.jakobs(at)web.de
+North Rhine-Westphalia                 Tobias Jakobs                   tobias.jakobs(at)web.de
+Norfolk Island, France         Tobias Jakobs                   tobias.jakobs(at)web.de
+Hamburg, Wales, Tunisia                Tobias Jakobs                   tobias.jakobs(at)web.de
+French Polynesia, French South.        Tobias Jakobs                   tobias.jakobs(at)web.de
+American Samoa, Montserat      Tobias Jakobs                   tobias.jakobs(at)web.de
+Pirate flags, historic navy    Tobias Jakobs                   tobias.jakobs(at)web.de
+Congo Kinshasa, Lower Saxony   Tobias Jakobs                   tobias.jakobs(at)web.de
+Northern Marianna, Saxony      Tobias Jakobs                   tobias.jakobs(at)web.de
+South Georg. & Sth Sandwich Is. Tobias Jakobs                  tobias.jakobs(at)web.de
+Schleswig Holstein, Berlin     Tobias Jakobs                   tobias.jakobs(at)web.de
+US Virgin Islands, Pitcairn    Tobias Jakobs                   tobias.jakobs(at)web.de
+Baden Wurtenberg               Tobias Jakobs                   tobias.jakobs(at)web.de
+Turkey                         Onur Yalaz                      onuryalazi(at)mersin.edu.tr
+Galicia                                Miguel Rodríguez               Miguel.Rodriguez(at)det.uvigo.es
+Finland        4:3                     Eetu Huisman                    eh(at)iki.fi
+Scotland, Cameron, Cyprus      Sigge Kotliar                   sigge(at)hystrix.se
+Georgia, USSR, Argentina       Sigge Kotliar                   sigge(at)hystrix.se
+Antigua,Macedonia, Venezuela   Sigge Kotliar                   sigge(at)hystrix.se
+Trinidad & Tobago, Panama      Sigge Kotliar                   sigge(at)hystrix.se
+Scotland color                 Duncan Innes                    duncan(at)innes.net
+German Swatstica               Christian Neumair               chris(at)gnome-de.org
+Switzerland, Swiss Naval       Philipp Frauenfelder            pfrauenf(at)math.ethz.ch
+Indonesia                      Kuswanto                        zeus(at)bajingloncat.com
+Iceland                                Áki G. Karlsson                        aki(at)akademia.is
+Israel                         John C Meuser                   meuserj(at)purdue.edu
+Spain_plain                    Francisco Camenforte Torres     fct834(at)alboran.ual.es
+Swiss 4:3                      Frank Murphy                    murphyf+sodipodi(at)f-m.fm
+Uruguay                                Eduardo Roldan                  trazor(at)multitel.com.uy
+Alaska, Colorado               Chris Hilker                    hilker(at)yahoo.com
+Jutland                                Kenneth Rohde Christiansen      kenneth(at)gnu.org
+South Africa                   Farrel Lifson                   flifson(at)cs.uct.ac.za
+Argentina_plain                        Ernesto Carrea                  enc(at)netcombbs.com.ar
+Belgium                                Gregory Deseck                  aeon(at)pandora.be
+Denmark                                Jens Bech Madsen                jbm(at)oncable.dk
+Esperanto                      Charles Voelger                 cvoelger(at)dweasel.com
+Netherland                     Marc Maurer                     j.m.maurer(at)student.utwente.nl
+Denmark                                Jens Bech Madsen                jbm(at)oncable.dk
+Armenia                                AnI AnI                         hayastan132(at)hotmail.com
+Arizona                                Thomas Reynolds                 Thomas.Reynolds(at)asu.edu
+Saint Vincet and Grenadines    Cezary Biel                     yemu(at)gazeta.pl
+Saudia Arabia, taiwan, tonga   Cezary Biel                     yemu(at)gazeta.pl
+Trinidad & Tobago, Uzbekistan  Cezary Biel                     yemu(at)gazeta.pl
+Togo, Macau, Brazil, Iran      Cezary Biel                     yemu(at)gazeta.pl
+Netherlands Antilles, Nauru    Cezary Biel                     yemu(at)gazeta.pl
+Timor Leste, Niue, Tuvalu      Cezary Biel                     yemu(at)gazeta.pl
+Christmas Island, Mexico       Cezary Biel                     yemu(at)gazeta.pl
+Tokelau, Burundi, Saint Lucia  Cezary Biel                     yemu(at)gazeta.pl
+Micronesia, Solomon Island     Cezary Biel                     yemu(at)gazeta.pl
+Sao Tome and principe          Cezary Biel                     yemu(at)gazeta.pl
+Rwanda                         Cezary Biel                     yemu(at)gazeta.pl
+Dominican Republic             Luis M                          lemsx1(at)hotmail.com
+Madagascar,Tanzania,Seychelles Russell Cloran                  russell(at)rucus.net
+North Carolina, South Carolina Steve Hall                      digitect(at)mindspring.com
+Alabama, Arkansas              Steve Hall                      digitect(at)mindspring.com
+Canada                         James Leigh                     james(at)leighnet.ca
+England                                Thom Sanders                    thom.sanders(at)btinternet.com
+Norway, Aaland, Faroe, NATO    Christian Schaller              christian.schaller(at)gnome.org
+Gibraltar, Palau, Honduras     Christian Schaller              christian.schaller(at)gnome.org
+Indiana, Lithuania, Cape Verde Christian Schaller              christian.schaller(at)gnome.org
+Guyana, Guinea Bissau          Christian Schaller              christian.schaller(at)gnome.or
+Yemen                          Thomas Tonino                   ttonino(at)users.sourceforge.net
+Australian Aboriginee, Mali    Brett Roper                     roperb(at)iinet.net.au
+Ivory Coast, Botswana, Monaco  Brett Roper                     brett(at)pudiga.org
+Nigeria, Mauritius, Chad       Brett Roper                     brett(at)pudiga.org
+El Salvador, Sierra Leone,Peru Brett Roper                     brett(at)pudiga.org
+Arab Emirates, Bolivia         Brett Roper                     brett(at)pudiga.org
+Australia, New Zealand, USA    Daniel McRae                    djm158(at)student.canterbury.ac.nz
+United Kingdom,        Armenia         Daniel McRae                    djm158(at)student.canterbury.ac.nz
+Azerbaijan, Bahamas, Belgium   Daniel McRae                    djm158(at)student.canterbury.ac.nz
+Benin, Bulgaria, Estonia       Daniel McRae                    djm158(at)student.canterbury.ac.nz
+Finland, Gabon, Gambia         Daniel McRae                    djm158(at)student.canterbury.ac.nz
+Greece,Greenland, Guinea       Daniel McRae                    djm158(at)student.canterbury.ac.nz
+Jamaica, Jordan, Romania       Daniel McRae                    djm158(at)student.canterbury.ac.nz      
+Puerto Rico                    Ricardo Veguilla González      veguilla(at)hpcf.upr.edu
+Germany                                Philipp Sadleder                philipp.sadleder(at)web.de
+Latvia                         Lauris Bukšis                  lauris(at)nix.lv
+Anguilla, Aruba, Albania       John C Meuser                   meuserj(at)purdue.edu
+Portugal                       Diogo Mamede                    euept(at)myrealbox.com
+Palestine                      Samir M. Nassar                 sp(at)steamedpenguin.com
+Bavaria                                Jörgen Scheibengruber          Joergen.Scheibengruber(at)wh-hms.uni-ulm.de
+Sweden                         Richard Torkar
+Croatia                                Frank Zeko                      frankz(at)dogstone.com
+Newfoundland                   Robert Crosbie                  swingincelt(at)hotmail.com
+Iraq, Ukraine, Irland, Ireland Lauris Kaplinski                lauris(at)kaplinski.com
+Malaysia                       Lauris Kaplinski                lauris(at)kaplinski.com
+Spain with emblem, Canary Is.  Pedro A. Gracia Fajardo         pedro(at)neuroomante.com
+Galicia, Murcia, Madrid                Pedro A. Gracia Fajardo         pedro(at)neuroomante.com
+Haiti                          Shawn J. Stewart                shawn(at)irietek.com
+Ontario                                Pat Suwalski                    pat(at)suwalski.net
+Brunei                         Gustav Broberg                  broberg(at)kth.se
+Qatar                          Craig Kacinko                   ckacinko(at)hotmail.com
+Manitoba,Nunavut, British Col. James Leigh                     james(at)leighnet.ca
+ohio                           Rob Davenport                   rgd(at)travellercentral.com
+Syria, Liberia, Suriname       Craig Kacinko                   ckacinko(at)hotmail.com
+Somalia, Djibouti              Craig Kacinko                   ckacinko(at)hotmail.com
+Maryland, Tennessee            Michael Wheeler                 mwheeler(at)ameritech.net
+California                     Jon A. Cruz                     joncruz(at)speakeasy.net
+Christian,New Mexico           Jeff Smith                      whydoubt(at)yahoo.com
+Senegal                                Adib                            taraben.a(at)wige-data.de
+Slovenia, Emirates_32          Matthew Gatto                   poobar(at)nycap.rr.com
+Tajikistan, Guatemala          Matthew Gatto                   poobar(at)nycap.rr.com
+Chile                          Mario Fuentes                   mario(at)gnome.cl
+Kazakhstan, Cambodia, Vanuatu  Caleb Moore                     calebmm(at)tpg.com.au
+Fiji, Lichtenstein, Moldova    Caleb Moore                     calebmm(at)tpg.com.au
+New South Wales,Turkmenistan   Caleb Moore                     calebmm(at)tpg.com.au
+Belarus, Malta, Dominica       Caleb Moore                     calebmm(at)tpg.com.au
+Oman,Belize, Swaziland         Caleb Moore                     calebmm(at)tpg.com.au
+Paraguay, Myanmar, Nicaragua   Caleb Moore                     calebmm(at)tpg.com.au
+Costa Rica, Eq. Guinea         Caleb Moore                     calebmm(at)tpg.com.au
+Ecuador, Andorra               Caleb Moore                     calebmm(at)tpg.com.au
+Maori, Vatican                 Caleb Moore                     calebmm(at)tpg.com.au
+British Indian Ocean Territory  Caleb Moore                    calebmm(at)tpg.com.au
+Australian Capitial Territory  Caleb Moore                     calebmm(at)tpg.com.au
+Australian Northern Territory  Caleb Moore                     calebmm(at)tpg.com.au
+Queensland, Victoria           Caleb Moore                     calebmm(at)tpg.com.au
+Western Australia              Caleb Moore                     calebmm(at)tpg.com.au
+Cook Islands, El Salvador      Caleb Moore                     calebmm(at)tpg.com.au
+Historical South Africa                Caleb Moore                     calebmm(at)tpg.com.au
+Tasmania, South Australia      Caleb Moore                     calebmm(at)tpg.com.au
+Canada NW Terr,        New Brunswick   Caleb Moore                     calebmm(at)tpg.com.au
+District of Columbia, Hawaii   Rob Adams                       readams(at)readams.net
+Piedmonte                      Luigi Maselli                   metnik(at)tiscali.it
+Waloon, Brussels, Flanders     Cedric de Launois               delaunois(at)info.ucl.ac.be
+Comoros, Eritrea, Kyrgyzstan   Andrew Duhan                    andrew.b.duhan(at)ttu.edu
+Guam, Marshal Islands          Andrew Duhan                    andrew.b.duhan(at)ttu.edu
+Western Sahara, Afghanistan    Andrew Duhan                    andrew.b.duhan(at)ttu.edu
+Wallis and Futuna              Andrew Duhan                    andrew.b.duhan(at)ttu.edu
+Belarus Historic               Vital Khilko                    dojlid(at)mova.org
+UNO,WHO,UNICEF,UNESCO          Wilfried Huss                   willihus(at)sbox.tugraz.at
+Spain Catalunya                        Xavier Conde Rueda              xaviconde(at)eresmas.com
diff --git a/third-party/license/tidy-html5/LICENSE.txt b/third-party/license/tidy-html5/LICENSE.txt
new file mode 100644 (file)
index 0000000..7dfc3a9
--- /dev/null
@@ -0,0 +1,45 @@
+
+  Copyright (c) 1998-2015 World Wide Web Consortium
+  (Massachusetts Institute of Technology, European Research 
+  Consortium for Informatics and Mathematics, Keio University).
+  All Rights Reserved.
+
+  Contributing Author(s):
+
+     Dave Raggett <dsr@w3.org>
+
+  The contributing author(s) would like to thank all those who
+  helped with testing, bug fixes and suggestions for improvements. 
+  This wouldn't have been possible without your help.
+
+  COPYRIGHT NOTICE:
+  This software and documentation is provided "as is," and
+  the copyright holders and contributing author(s) make no
+  representations or warranties, express or implied, including
+  but not limited to, warranties of merchantability or fitness
+  for any particular purpose or that the use of the software or
+  documentation will not infringe any third party patents,
+  copyrights, trademarks or other rights. 
+
+  The copyright holders and contributing author(s) will not be held
+  liable for any direct, indirect, special or consequential damages
+  arising out of any use of the software or documentation, even if
+  advised of the possibility of such damage.
+
+  Permission is hereby granted to use, copy, modify, and distribute
+  this source code, or portions hereof, documentation and executables,
+  for any purpose, without fee, subject to the following restrictions:
+
+  1. The origin of this source code must not be misrepresented.
+  2. Altered versions must be plainly marked as such and must
+     not be misrepresented as being the original source.
+  3. This Copyright notice may not be removed or altered from any
+     source or altered source distribution.
+  The copyright holders and contributing author(s) specifically
+  permit, without fee, and encourage the use of this source code
+  as a component for supporting the Hypertext Markup Language in
+  commercial products. If you use this source code in a product,
+  acknowledgment is not required but would be appreciated.
+