ZGen  0.2.0
a linearization system for natural language.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
score_context.h
Go to the documentation of this file.
1 #ifndef __ZGEN_BESTFIRST_MODEL_SCORE_CONTEXT_H__
2 #define __ZGEN_BESTFIRST_MODEL_SCORE_CONTEXT_H__
3 
4 #include <vector>
5 #include "settings.h"
8 
9 namespace ZGen {
10 
11 namespace BestFirst {
12 
13 struct ScoreContext {
14  ScoreContext(const Span& span) {
15  int id = span.root_id;
16 
17  ref = span.ref;
18  word = span.ref->forms.at(id);
19  tag = span.tag;
20 
24  }
25 
26  const dependency_t* ref;
27  word_t word; /*< The form of the current span */
28  postag_t tag; /*< The postag of the current span */
29  std::vector<word_t> words; /*< The linearized words */
30  std::vector<postag_t> postags; /*< The linearized postags */
31  std::vector<word_t> head_words; /*< The head word of the span */
33  std::vector<SpanUtils::relation_t> relations;
34 };
35 
37 
38 } // end for namespace BestFirst
39 
40 } // end for namespace ZGen
41 
42 #endif // end for __ZGEN_BESTFIRST_MODEL_SCORE_CONTEXT_H__
ScoreContext(const Span &span)
Definition: score_context.h:14
word_t word
Definition: score_context.h:27
const dependency_t * ref
Definition: score_context.h:26
postag_t tag
Definition: span.h:83
int word_t
Definition: instance.h:11
Definition: instance.h:18
postag_t tag
Definition: score_context.h:28
ScoreContext ctx_t
Definition: score_context.h:36
std::vector< word_t > forms
Definition: instance.h:21
static void get_all_linearized_postags(const Span *span, std::vector< postag_t > &postags)
Definition: span_utils.cc:157
std::vector< word_t > words
Definition: score_context.h:29
int postag_t
Definition: instance.h:12
static void get_all_relations(const Span *span, std::vector< relation_t > &relations)
Definition: span_utils.cc:8
Definition: score_context.h:13
std::vector< word_t > head_words
Definition: score_context.h:31
static void get_all_linearized_words(const Span *span, std::vector< word_t > &words)
Definition: span_utils.cc:140
Definition: span.h:13
int root_id
Definition: span.h:82
const dependency_t * ref
Definition: span.h:81
std::vector< postag_t > postags
Definition: score_context.h:30
std::vector< SpanUtils::relation_t > relations
Definition: score_context.h:33