From b35c4d5f3862f64d968a1f99122e1e7cdb4124da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20K=C4=99dzia?= <Pawel.Kedzia@pwr.wroc.pl> Date: Tue, 15 Nov 2011 10:46:15 +0100 Subject: [PATCH] Added sentence identifier (default is set as empty identifer) --- libcorpus2/sentence.cpp | 4 ++-- libcorpus2/sentence.h | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libcorpus2/sentence.cpp b/libcorpus2/sentence.cpp index 30f33e3..aaacf62 100644 --- a/libcorpus2/sentence.cpp +++ b/libcorpus2/sentence.cpp @@ -19,8 +19,8 @@ or FITNESS FOR A PARTICULAR PURPOSE. namespace Corpus2 { -Sentence::Sentence() - : tokens_() +Sentence::Sentence(const std::string &id) + : tokens_(), id_(id) { } diff --git a/libcorpus2/sentence.h b/libcorpus2/sentence.h index ddbb704..ee572d9 100644 --- a/libcorpus2/sentence.h +++ b/libcorpus2/sentence.h @@ -45,8 +45,9 @@ public: /// Convenience typedef for a shared pointer to a const Sentence typedef boost::shared_ptr<const Sentence> ConstPtr; - /// Empty constructor. Creates a Sentence with no tokens. - Sentence(); + /// Constructor with default (empty) sentence identifier. + /// Creates a Sentence with no tokens. + Sentence(const std::string &id = ""); /// Sentence cloning. All the tokens are duplicated. virtual Ptr clone_shared() const; @@ -115,6 +116,9 @@ public: protected: /// The tokens this sentence contains and owns std::vector<Token*> tokens_; + + /// The sentence identifer - default is empty + const std::string id_; }; } /* end ns Corpus2 */ -- GitLab