Skip to content
Snippets Groups Projects
Commit 1e5502b4 authored by Adam Radziszewski's avatar Adam Radziszewski
Browse files

fx premorph writer: escape XML entities

parent a0b4cb98
Branches
No related merge requests found
......@@ -2,7 +2,7 @@ PROJECT(Corpus2Library)
set(corpus2_ver_major "1")
set(corpus2_ver_minor "3")
set(corpus2_ver_patch "1")
set(corpus2_ver_patch "2")
cmake_minimum_required(VERSION 2.8.0)
......
......@@ -17,6 +17,9 @@ or FITNESS FOR A PARTICULAR PURPOSE.
#include <libcorpus2/io/premorphwriter.h>
#include <boost/foreach.hpp>
// for entity encoding
#include <libcorpus2/io/xcescommon.h>
namespace Corpus2 {
bool PremorphWriter::registered = TokenWriter::register_writer<PremorphWriter>(
......@@ -42,14 +45,15 @@ PremorphWriter::~PremorphWriter()
void PremorphWriter::write_token(const Token &t)
{
os() << PwrNlp::Whitespace::to_whitespace(t.wa()) << t.orth_utf8();
os() << PwrNlp::Whitespace::to_whitespace(t.wa());
encode_xml_entities_into(os(), t.orth_utf8());
}
void PremorphWriter::write_sentence(const Sentence &s)
{
os() << "<chunk type=\"s\">";
if (!s.tokens().empty()) {
os() << s[0]->orth_utf8();
encode_xml_entities_into(os(), s[0]->orth_utf8());
}
for (size_t i = 1; i < s.tokens().size(); ++i) {
write_token(*s[i]);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment