Frog
AlpinoParser.h
Go to the documentation of this file.
1 /* ex: set tabstop=8 expandtab: */
2 /*
3  Copyright (c) 2006 - 2020
4  CLST - Radboud University
5  ILK - Tilburg University
6 
7  This file is part of frog:
8 
9  A Tagger-Lemmatizer-Morphological-Analyzer-Dependency-Parser for
10  several languages
11 
12  frog is free software; you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation; either version 3 of the License, or
15  (at your option) any later version.
16 
17  frog is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program. If not, see <http://www.gnu.org/licenses/>.
24 
25  For questions and suggestions, see:
26  https://github.com/LanguageMachines/frog/issues
27  or send mail to:
28  lamasoftware (at ) science.ru.nl
29 
30 */
31 
32 #ifndef ALPINO_PARSER_H
33 #define ALPINO_PARSER_H
34 
35 #include <string>
36 #include <vector>
37 #include <set>
38 #include <libxml/tree.h>
39 #include "frog/Parser.h"
40 
41 class frog_data;
42 
43 struct dp_tree {
44  int id;
45  int begin;
46  int end;
48  std::string word;
49  std::string rel;
53  delete link;
54  delete next;
55  }
56 };
57 
58 std::ostream& operator<<( std::ostream& os, const dp_tree *node );
59 
60 std::vector<parsrel> alpino_server_parse( frog_data& fd );
61 
62 class AlpinoParser: public ParserBase {
63  public:
64  explicit AlpinoParser( TiCC::LogStream* errlog, TiCC::LogStream* dbglog ):
65  ParserBase( errlog, dbglog ),
66  _alpino_server(false)
67  {};
68  bool init( const TiCC::Configuration& );
69  void add_provenance( folia::Document& doc, folia::processor * ) const;
70  void Parse( frog_data&, TimerBlock& );
71  void add_result( const frog_data&,
72  const std::vector<folia::Word*>& ) const;
73  void add_mwus( const frog_data&,
74  const std::vector<folia::Word*>& ) const;
75  private:
76  std::vector<parsrel> alpino_parse( frog_data& );
77  std::vector<parsrel> alpino_server_parse( frog_data& );
78  bool _alpino_server;
79 };
80 
81 
82 #endif
AlpinoParser::add_provenance
void add_provenance(folia::Document &doc, folia::processor *) const
Definition: AlpinoParser.cxx:60
AlpinoParser
Definition: AlpinoParser.h:62
Parser.h
frog_data
a datastructure to hold all frogged information of one Sentence
Definition: FrogData.h:76
dp_tree::next
dp_tree * next
Definition: AlpinoParser.h:51
dp_tree::end
int end
Definition: AlpinoParser.h:46
ParserBase
Definition: Parser.h:51
AlpinoParser::add_result
void add_result(const frog_data &, const std::vector< folia::Word * > &) const
Definition: AlpinoParser.cxx:309
operator<<
std::ostream & operator<<(std::ostream &os, const dp_tree *node)
Definition: AlpinoParser.cxx:322
dp_tree::link
dp_tree * link
Definition: AlpinoParser.h:50
alpino_server_parse
std::vector< parsrel > alpino_server_parse(frog_data &fd)
dp_tree::rel
std::string rel
Definition: AlpinoParser.h:49
dp_tree
Definition: AlpinoParser.h:43
dp_tree::word
std::string word
Definition: AlpinoParser.h:48
dp_tree::begin
int begin
Definition: AlpinoParser.h:45
dp_tree::id
int id
Definition: AlpinoParser.h:44
dp_tree::~dp_tree
~dp_tree()
Definition: AlpinoParser.h:52
AlpinoParser::AlpinoParser
AlpinoParser(TiCC::LogStream *errlog, TiCC::LogStream *dbglog)
Definition: AlpinoParser.h:64
dp_tree::word_index
int word_index
Definition: AlpinoParser.h:47
AlpinoParser::Parse
void Parse(frog_data &, TimerBlock &)
Definition: AlpinoParser.cxx:204
AlpinoParser::add_mwus
void add_mwus(const frog_data &, const std::vector< folia::Word * > &) const
Definition: AlpinoParser.cxx:268
TimerBlock
Definition: Frog-util.h:51
AlpinoParser::init
bool init(const TiCC::Configuration &)
Definition: AlpinoParser.cxx:91