[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/base/nepomuk-kde/scribo/plugins/pimo
From:       Sebastian Trueg <sebastian () trueg ! de>
Date:       2009-06-19 7:28:35
Message-ID: 1245396515.871516.31901.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 983781 by trueg:

added stopwords to lessen debug messages

 M  +15 -2     pimotextmatchplugin.cpp  
 M  +3 -1      pimotextmatchplugin.h  


--- trunk/playground/base/nepomuk-kde/scribo/plugins/pimo/pimotextmatchplugin.cpp #983780:983781
@@ -45,6 +45,14 @@
 PimoTextMatchPlugin::PimoTextMatchPlugin( QObject* parent, const QVariantList& )
     : TextMatchPlugin( parent )
 {
+    m_stopWords << QLatin1String( "and" )
+                << QLatin1String( "or" )
+                << QLatin1String( "the" )
+                << QLatin1String( "that" )
+                << QLatin1String( "this" )
+                << QLatin1String( "there" )
+                << QLatin1String( "for" )
+                << QLatin1String( "with" );
 }
 
 
@@ -83,12 +91,15 @@
 }
 
 
-void PimoTextMatchPlugin::queryWord( const QString& word )
+bool PimoTextMatchPlugin::queryWord( const QString& word )
 {
     if ( word.length() < s_minLength ) {
 //        kDebug() << word << "too short";
-        return;
+        return false;
     }
+    else if ( m_stopWords.contains( word.toLower() ) ) {
+        return false;
+    }
 
 //    kDebug() << "checking word" << word;
 
@@ -114,6 +125,8 @@
             addNewMatch( entity );
         }
     }
+
+    return true;
 }
 
 
--- trunk/playground/base/nepomuk-kde/scribo/plugins/pimo/pimotextmatchplugin.h #983780:983781
@@ -24,6 +24,7 @@
 #include "textmatchplugin.h"
 
 #include <QtCore/QVariant>
+#include <QtCore/QStringList>
 
 /**
  * TextMatchPlugin that simply looks through the text, looking for each word
@@ -42,11 +43,12 @@
 
 private Q_SLOTS:
     void scanText();
-    void queryWord( const QString& word );
+    bool queryWord( const QString& word );
 
 private:
     QString m_text;
     int m_pos;
+    QStringList m_stopWords;
 };
 
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic