LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
bowXMLWriter.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 bowXMLWriter.h
9 * @author Besancon Romaric (besanconr@zoe.cea.fr)
10 * @date Wed May 5 2004
11 * copyright Copyright (C) 2004 by CEA LIST
12 * Project BagOfWords
13 *
14 * @brief XML input/output for BoW elements
15 *
16 *
17 ***********************************************************************/
18
19#ifndef BOWXMLWRITER_H
20#define BOWXMLWRITER_H
21
24
25#include <string>
26#include <iostream>
27
28namespace Lima {
29namespace Common {
30namespace BagOfWords {
31
32
33class BoWXMLWriterPrivate;
34class BoWToken;
35class BoWRelation;
36class BoWText;
37class BoWDocument;
38class IndexElement;
39
41{
42 public:
43 BoWXMLWriter(std::ostream& os,
44 int32_t offset=0); // general offset to adjust all positions
45 virtual ~BoWXMLWriter();
46
47 void writeBoWText(const BoWText* document,
48 const bool useIterator,
49 const bool useIndexIterator);
50 void writeBoWToken(const BoWToken* token);
51 void writeBoWDocument(const BoWDocument* document,
52 const bool useIterator,
53 const bool useIndexIterator);
54
55 // root tags for valid XML if several documents
56 void writeBoWDocumentsHeader();
57 void writeBoWDocumentsFooter();
58 void writeDocumentsHeader() override {writeBoWDocumentsHeader();};
59 void writeDocumentsFooter() override {writeBoWDocumentsFooter();};
60
61 // Implementation of AbstractBoWXMLWriter functions
62 void openSBoWNode(const Lima::Common::Misc::GenericDocumentProperties* properties,
63 const std::string& elementName) override;
64 void openSBoWIndexingNode(const Lima::Common::Misc::GenericDocumentProperties* properties,
65 const std::string& elementName) override;
66 void processSBoWText(const BoWText* boWText,
67 bool useIterators,
68 bool useIndexIterator) override;
69 void processProperties(const Misc::GenericDocumentProperties* properties,
70 bool useIterators,
71 bool useIndexIterator) override;
72 void closeSBoWNode() override;
73 void writeIndexElement(const IndexElement& element);
74 void setSpaces(const std::string& s);
75 void incIndent();
76 void decIndent();
77
78
79 void setLanguage(const Lima::MediaId lang);
80 void setLanguage(const std::string& lang);
81private:
83 BoWXMLWriter& operator=(const BoWXMLWriter&);
85};
86
87} // end namespace
88} // end namespace
89} // end namespace
90
91#endif
#define LIMA_BOW_EXPORT
represent a document as a Bag Of Word, with associated document properties.
Definition bowDocument.h:57
This class represents a list of elements, that are pointers on polymmorphic tokens that can be simple...
Definition bowText.h:48
This class contains the representation of an element of the bag of words.
Definition bowToken.h:46
void writeBoWDocument(const BoWDocument *document, const bool useIterator, const bool useIndexIterator)
Represent an element of an index If it is a predicate, its simple term is "PredicateElement" and its ...
NAUTITIA.