From d5624615edc59e8b12713575c0a98c4f532fa3ae Mon Sep 17 00:00:00 2001 From: Adam Radziszewski <adam.radziszewski@pwr.wroc.pl> Date: Mon, 10 Oct 2011 13:42:54 +0200 Subject: [PATCH] convenienct after_space func in Token --- libcorpus2/token.h | 5 +++++ swig/token.i | 1 + 2 files changed, 6 insertions(+) diff --git a/libcorpus2/token.h b/libcorpus2/token.h index 5cd4f61..4da41e3 100644 --- a/libcorpus2/token.h +++ b/libcorpus2/token.h @@ -90,6 +90,11 @@ public: void set_wa(const PwrNlp::Whitespace::Enum& wa) { wa_ = wa; } + + /// If any whitespace came before this token. + bool after_space() const { + return wa_ != PwrNlp::Whitespace::None; + } /// Lexemes getter const std::vector<Lexeme>& lexemes() const { diff --git a/swig/token.i b/swig/token.i index 0c8373f..7e5cb2f 100644 --- a/swig/token.i +++ b/swig/token.i @@ -37,6 +37,7 @@ namespace Corpus2 { const PwrNlp::Whitespace::Enum& wa() const; void set_wa(const PwrNlp::Whitespace::Enum& wa); + bool after_space() const; const std::vector<Lexeme>& lexemes() const; std::vector<Lexeme>& lexemes(); -- GitLab