use of eu.transkribus.core.model.beans.pagecontent.TextLineType in project TranskribusCore by Transkribus.
the class TrpPageTypeUtils method assignUniqueIDs.
/**
* Assigns unique IDs to the elements in the page using the current order of the elements.
*/
public static void assignUniqueIDs(PageType page) {
int i = 1;
for (RegionType r : page.getTextRegionOrImageRegionOrLineDrawingRegion()) {
if (r instanceof TextRegionType) {
TextRegionType region = (TextRegionType) r;
String rid = "r" + i;
region.setId(rid);
int j = 1;
for (TextLineType l : region.getTextLine()) {
String lid = rid + "l" + j;
l.setId(lid);
int k = 1;
for (WordType word : l.getWord()) {
String wid = lid + "w" + k;
word.setId(wid);
k++;
}
++j;
}
++i;
}
}
}
use of eu.transkribus.core.model.beans.pagecontent.TextLineType in project TranskribusCore by Transkribus.
the class CustomTagUtil method getIndexedCustomTagsForLines.
public static <T extends CustomTag> List<T> getIndexedCustomTagsForLines(TrpTextRegionType region, String tagName) {
List<T> tags = new ArrayList<>();
CustomTag ct = null;
for (TextLineType l : region.getTextLine()) {
TrpTextLineType tl = (TrpTextLineType) l;
List<T> lineTags = tl.getCustomTagList().getIndexedTags(tagName);
for (T t : lineTags) {
if (ct != null && isContinuation(tagName, t)) {
ct.continuations.add(t);
} else {
tags.add(t);
ct = t.isContinued() ? t : null;
}
}
}
return tags;
}
Aggregations