strusAnalyzer  0.17
posTaggerDataInterface.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Patrick P. Frey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
10 #ifndef _STRUS_ANALYZER_POS_TAGGER_DATA_INTERFACE_HPP_INCLUDED
11 #define _STRUS_ANALYZER_POS_TAGGER_DATA_INTERFACE_HPP_INCLUDED
13 #include <string>
14 #include <vector>
15 
17 namespace strus
18 {
19 
21 class TokenMarkupContextInterface;
22 
25 {
26 public:
28  class Element
29  {
30  public:
32  static const char* typeName( Type t)
33  {
34  static const char* ar[] = {"Marker","Content","BoundToPrevious",0};
35  return ar[ t];
36  }
37  const Type type() const {return m_type;}
38  const std::string& tag() const {return m_tag;}
39  const std::string& value() const {return m_value;}
40  const std::string& ref() const {return m_ref;}
41 
46  Element( const Type& type_, const std::string& tag_, const std::string& value_, const std::string& ref_)
47  :m_type(type_),m_tag(tag_),m_value(value_),m_ref(ref_){}
49  Element( const Element& o)
50  :m_type(o.m_type),m_tag(o.m_tag),m_value(o.m_value),m_ref(o.m_ref){}
51 
52  private:
53  Type m_type;
54  std::string m_tag;
55  std::string m_value;
56  std::string m_ref;
57  };
58 
60 
64  virtual void declareIgnoredToken( const std::string& value)=0;
65 
68  virtual void insert( int docno, const std::vector<Element>& sequence)=0;
69 
77  virtual void markupSegment( TokenMarkupContextInterface* markupContext, int docno, int& docitr, const SegmenterPosition& segmentpos, const char* segmentptr, std::size_t segmentsize) const=0;
78 };
79 
80 }//namespace
81 #endif
82 
virtual void insert(int docno, const std::vector< Element > &sequence)=0
Add a tagged text chunk.
Definition: posTaggerDataInterface.hpp:31
virtual void declareIgnoredToken(const std::string &value)=0
Declare a token to be ignored in the document elements, if it does not match.
const std::string & tag() const
Tag string.
Definition: posTaggerDataInterface.hpp:38
Definition: posTaggerDataInterface.hpp:31
const std::string & ref() const
Referenced translation value of token (id attribute of tagged value)
Definition: posTaggerDataInterface.hpp:40
Interface for the data built by a POS tagger.
Definition: posTaggerDataInterface.hpp:24
virtual void markupSegment(TokenMarkupContextInterface *markupContext, int docno, int &docitr, const SegmenterPosition &segmentpos, const char *segmentptr, std::size_t segmentsize) const =0
Get a text chunk tagged.
int SegmenterPosition
Position of a segment in the original source.
Definition: segmenterContextInterface.hpp:20
const std::string & value() const
Value of token (tagged value)
Definition: posTaggerDataInterface.hpp:39
Definition: posTaggerDataInterface.hpp:31
Interface for the execution context of a document segmenter.
virtual ~PosTaggerDataInterface()
Definition: posTaggerDataInterface.hpp:59
Type
Definition: posTaggerDataInterface.hpp:31
Interface for annotation of text in one document.
Definition: tokenMarkupContextInterface.hpp:25
static const char * typeName(Type t)
Definition: posTaggerDataInterface.hpp:32
Output element declaration for POS tagging.
Definition: posTaggerDataInterface.hpp:28
const Type type() const
Type of mapping.
Definition: posTaggerDataInterface.hpp:37
Element(const Type &type_, const std::string &tag_, const std::string &value_, const std::string &ref_)
Constructor.
Definition: posTaggerDataInterface.hpp:46
Element(const Element &o)
Copy constructor.
Definition: posTaggerDataInterface.hpp:49