21 virtual void read(
const std::string& buf,
char sep =
'\t') = 0;
22 virtual std::string
write(
char sep =
'\t')
const = 0;
40 explicit idx_t(
const std::string& s)
44 throw std::logic_error(
"Can't parse string \"" + s +
"\" as idx_t");
63 bool parse(
const std::string& s);
70 explicit Line(
const std::string& buf,
char sep =
'\t')
78 virtual void read(
const std::string& buf,
char sep =
'\t');
79 virtual std::string
write(
char sep =
'\t')
const;
85 explicit CoNLLULine(
const std::string& buf,
char sep =
'\t')
98 virtual void read(
const std::string& buf,
char sep =
'\t')
103 virtual std::string
write(
char sep =
'\t')
const;
153 inline const std::string&
form()
const
158 inline const std::string&
lemma()
const
163 inline const std::string&
upos()
const
168 inline const std::string&
xpos()
const
178 inline const std::map<std::string, std::set<std::string>>&
feats()
const
195 const auto it =
_feats.find(feat_name);
200 if (it->second.end() != it->second.find(
"Yes") || it->second.end() != it->second.find(
"yes"))
217 static bool parse_feats(
const std::string& s, std::map<std::string, std::set<std::string>>&
_feats);
227 inline void read_impl(
const std::string& buf,
char sep =
'\t')
268 std::map<std::string, std::set<std::string>>
_feats;
280 std::map<std::string, std::string>
_misc;
bool parse_deps(const std::string &s)
bool is_empty_line() const
std::string serialize_string(const std::string &s) const
std::string feats_str() const
std::map< std::string, std::string > _misc
std::vector< dep_t > _deps
const std::map< std::string, std::set< std::string > > & feats() const
const idx_t & head() const
const std::string & deprel() const
const std::string & form() const
CoNLLULine(const Line &line)
bool get_binary_feature(const std::string &feat_name) const
const std::string & lemma() const
virtual std::string write(char sep='\t') const
bool is_comment_line() const
const idx_t & idx() const
bool parse_misc(const std::string &s)
bool parse_string_field(const std::string &s, std::string &out, bool raw=false)
bool is_real_word_line() const
void read_impl(const std::string &buf, char sep='\t')
virtual void read(const std::string &buf, char sep='\t')
bool is_token_line() const
std::string serialize_misc() const
const std::string & upos() const
std::string serialize_feats() const
CoNLLULine(const std::string &buf, char sep='\t')
virtual void init(const Line &line)
const std::string & xpos() const
std::map< std::string, std::set< std::string > > _feats
void init_impl(const Line &line)
virtual ~CoNLLULine()=default
static bool parse_feats(const std::string &s, std::map< std::string, std::set< std::string > > &_feats)
std::string serialize_deps() const
Line(const std::string &buf, char sep='\t')
virtual void read(const std::string &buf, char sep='\t')
virtual std::string write(char sep='\t') const
virtual std::string write(char sep='\t') const =0
virtual void read(const std::string &buf, char sep='\t')=0
dep_t(idx_t head, std::string deprel)
std::string serialize() const
feature_t(const std::string &key, const std::string &value)
std::string serialize() const
std::set< std::string > _values
feature_t(const std::string &key, const std::set< std::string > &values)
bool parse(const std::string &s)
bool is_multiword() const
bool is_real_word() const
idx_t(const std::string &s)
idx_t(base_int_t first, base_int_t last, base_int_t sub=0)
std::string serialize() const