LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
bowDocumentST.h
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6/************************************************************************
7 *
8 * @file bowDocumentST.h
9 * @author Besancon Romaric (besanconr@zoe.cea.fr)
10 * @date Fri Oct 10 2003
11 * copyright Copyright (C) 2003 by CEA LIST
12 * Project BagOfWords
13 *
14 * @brief bag-of-words representation of a document
15 *
16 *
17 ***********************************************************************/
18
19#ifndef BOWDOCUMENTST_H
20#define BOWDOCUMENTST_H
21
23#include "bowDocument.h"
24#include <iostream>
25
26namespace Lima {
27namespace Common {
28namespace BagOfWords {
29
31{
32 public:
35 virtual ~BoWDocumentST();
36 BoWDocumentST& operator = (const BoWDocumentST&);
37
38 const std::vector<BoWText::const_iterator>& getSentenceBreaks() const;
39 const std::vector<BoWText::const_iterator>& getTopicShifts() const;
40
41 void reinit() override;
42
43 void addSentenceBreak(const BoWText::const_iterator);
44 void addTopicShift(const BoWText::const_iterator);
45
46 // text input/output
52 // friend std::wostream& operator << (std::wostream&, const BoWDocumentST&);
53 friend LIMA_BOW_EXPORT std::ostream& operator << (std::ostream&, const BoWDocumentST&);
54
55 // binary input/output
61 void read(std::istream& file) override;
62 void write(std::ostream& file) const;
63 void writeSTData(std::ostream& file) const;
64
65 private:
66 std::vector<BoWText::const_iterator> m_sentenceBreaks;
67 std::vector<BoWText::const_iterator> m_topicShifts;
68
69 //private functions
70 void copySTData(const BoWDocumentST& d);
71
72};
73//**********************************************************************
74// inline functions
75//**********************************************************************
76inline const std::vector<BoWText::const_iterator>&
78{
79 return m_sentenceBreaks;
80}
81inline const std::vector<BoWText::const_iterator>&
83{
84 return m_topicShifts;
85}
86
87inline void BoWDocumentST::addSentenceBreak(const BoWText::const_iterator i)
88{
89 m_sentenceBreaks.push_back(i);
90}
91inline void BoWDocumentST::addTopicShift(const BoWText::const_iterator i)
92{
93 m_topicShifts.push_back(i);
94}
95
96
97} // end namespace
98} // end namespace
99} // end namespace
100
101#endif
QDebug & operator<<(QDebug &qd, const std::string &str)
Definition QsLog.cpp:39
#define LIMA_BOW_EXPORT
const std::vector< BoWText::const_iterator > & getSentenceBreaks() const
const std::vector< BoWText::const_iterator > & getTopicShifts() const
void addTopicShift(const BoWText::const_iterator)
void addSentenceBreak(const BoWText::const_iterator)
represent a document as a Bag Of Word, with associated document properties.
Definition bowDocument.h:57
NAUTITIA.