diff --git a/libcorpus2/sentence.cpp b/libcorpus2/sentence.cpp index 30f33e3de94a6d6514bcef47301290069bfbb0ff..aaacf628f542a10d59be5718d05c2fea47020328 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 ddbb70461adf4a5c993073ff92373ff85f4e9e14..ee572d9ea669f24b0f522f642c423bb8e4c782cd 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 */