Skip to content

Commit

Permalink
small fix after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed Dec 5, 2024
1 parent 83f4428 commit f23a522
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ucto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- master
- develop

paths:
- 'src/**'
Expand Down Expand Up @@ -45,10 +46,12 @@ jobs:

- uses: LanguageMachines/ticcactions/cpp-submodule-build@v1
with:
branch: ${{ github.ref_name }}
module: ticcutils

- uses: LanguageMachines/ticcactions/cpp-submodule-build@v1
with:
branch: ${{ github.ref_name }}
module: libfolia

- uses: LanguageMachines/ticcactions/cpp-submodule-build@v1
Expand Down
26 changes: 15 additions & 11 deletions src/tokenize.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,10 @@ namespace Tokenizer {
outputclass("current"),
text_cat( 0 )
{
theErrLog = new TiCC::LogStream(cerr, "ucto" );
theErrLog = new TiCC::LogStream(cerr);
theErrLog->set_message( "ucto" );
theDbgLog = theErrLog;
theErrLog->setstamp( StampMessage );
theErrLog->set_stamp( StampMessage );
}

TokenizerClass::~TokenizerClass(){
Expand Down Expand Up @@ -1000,7 +1001,7 @@ namespace Tokenizer {
// there is already text at thus level, bail out.
return;
}
if ( root->isSubClass( folia::Linebreak_t ) ){
if ( root->isSubClass<folia::Linebreak>() ){
// exception
return;
}
Expand Down Expand Up @@ -1217,7 +1218,7 @@ namespace Tokenizer {
}
else {
const folia::FoliaElement *par = el->parent();
if ( par->element_id() == folia::BASE ){
if ( par->isinstance<folia::FoLiA>() ){
// we went all up without avail...
return "";
}
Expand Down Expand Up @@ -1307,7 +1308,7 @@ namespace Tokenizer {
}
else if ( (tok.role & BEGINOFSENTENCE)
&& root != sent
&& root->element_id() == folia::Sentence_t ){
&& root->isinstance<folia::Sentence>() ){
// Ok, another Sentence in a quote
if ( i > 0 && !(toks[i-1].role & BEGINQUOTE) ){
// close the current one, and start a new one.
Expand Down Expand Up @@ -1433,7 +1434,7 @@ namespace Tokenizer {
args["set"] = root->doc()->default_set( folia::AnnotationType::PARAGRAPH );
args["xml:id"] = root->doc()->id() + ".p." + TiCC::toString(++p_count);
folia::Paragraph *p = new folia::Paragraph( args, root->doc() );
if ( root->element_id() == folia::Text_t ){
if ( root->isinstance<folia::Text>() ){
if ( tokDebug > 5 ){
DBG << "append_to_folia, add paragraph to Text" << endl;
}
Expand Down Expand Up @@ -1674,10 +1675,11 @@ namespace Tokenizer {
int& sentence_done ){
// a Paragraph may contain both Word and Sentence nodes
// Sentences will be handled
vector<folia::Sentence*> sv = p->select<folia::Sentence>(false);
vector<folia::Sentence*> sv
= p->select<folia::Sentence>(folia::SELECT_FLAGS::LOCAL);
if ( sv.empty() ){
// No Sentence, so just text or Words
vector<folia::Word*> wv = p->select<folia::Word>(false);
vector<folia::Word*> wv = p->select<folia::Word>(folia::SELECT_FLAGS::LOCAL);
if ( !wv.empty() ){
vector<folia::FoliaElement*> ev( wv.begin(), wv.end() );
// Words found
Expand Down Expand Up @@ -1777,8 +1779,10 @@ namespace Tokenizer {
// maybe <div> or <note> or such
// there may be embedded Paragraph, Word and Sentence nodes
// if so, Paragraphs and Sentences should be handled separately
vector<folia::Sentence*> sv = e->select<folia::Sentence>(false);
vector<folia::Paragraph*> pv = e->select<folia::Paragraph>(false);
vector<folia::Sentence*> sv
= e->select<folia::Sentence>(folia::SELECT_FLAGS::LOCAL);
vector<folia::Paragraph*> pv
= e->select<folia::Paragraph>(folia::SELECT_FLAGS::LOCAL);
if ( pv.empty() && sv.empty() ){
// just words or text
UnicodeString text = e->unicode( text_policy );
Expand All @@ -1800,7 +1804,7 @@ namespace Tokenizer {
// multiple sentences. We need an extra Paragraph.
// But first check if this is allowed!
folia::FoliaElement *rt;
if ( e->acceptable(folia::Paragraph_t) ){
if ( e->acceptable<folia::Paragraph>() ){
folia::KWargs args;
string e_id = e->id();
if ( !e_id.empty() ){
Expand Down

0 comments on commit f23a522

Please sign in to comment.