PLearn 0.1
Functions
punctuation_filter.cc File Reference
#include <plearn/base/general.h>
Include dependency graph for punctuation_filter.cc:

Go to the source code of this file.

Functions

bool isLetter (char c)
bool isDigit (char c)
bool isAlpha (char c)
bool isPunctuation (string word)
int main (int argc, char **argv)

Function Documentation

bool isAlpha ( char  c)

Definition at line 17 of file punctuation_filter.cc.

References PLearn::isDigit(), and PLearn::isLetter().

{
    return (isLetter(c) || isDigit(c));
}

Here is the call graph for this function:

bool isDigit ( char  c)

Definition at line 12 of file punctuation_filter.cc.

{
    return (c >= 48 && c <= 57);
}
bool isLetter ( char  c)

Definition at line 7 of file punctuation_filter.cc.

{
    return (c >= 65 && c <= 90) || (c >= 97 && c <= 122);
}
bool isPunctuation ( string  word)

Definition at line 22 of file punctuation_filter.cc.

References i, and PLearn::isAlpha().

{
    for (int i = 0; i < word.size(); i++)
    {
        if (isAlpha(word[i])) return false;
    }
    return true;
}

Here is the call graph for this function:

int main ( int  argc,
char **  argv 
)

Definition at line 31 of file punctuation_filter.cc.

References PLearn::endl(), isPunctuation(), and PLERROR.

{
    if (argc != 1)
        PLERROR("usage : punctuation_filter < in.text > filtered_out.text");
    string word;
    while (true)
    {
        cin >> word;
        if (!cin) break;
        if (isPunctuation(word))
            //cout << "<punctuation>" << " : " << word << endl;
            cout << "<punctuation>" << endl;
        else
            cout << word << endl;
    }
}

Here is the call graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines