/** * Converts a letter-coded text to a fragment. * <p>A letter-coded text is like "<g1>text<x2/></g1><b3/>". * @param text the text to convert. * @param fragment optional existing fragment where to set the converted data, or null to create a new fragment. * If an existing fragment is provided, no existing code is preserved: all codes are coming from the parsing * of the input text, except if reuseCodes is set to true. * @param reuseCodes true to re-use the codes of the provided text fragment. If a code is not found in the * provided text fragment, one is created for the output. * @return the new fragment created from the text. */ @Deprecated public static TextFragment fromLetterCodedToFragment (String text, TextFragment fragment, boolean reuseCodes) { return fromLetterCodedToFragment(text, fragment, reuseCodes, false); }
TextFragment generateResult(String translated) { return GenericContent.fromLetterCodedToFragment(translated, originalFragment.clone(), true, true); } }
private TextFragment toAbstract (TextFragment frag) { // If the entry is from extraction/merge mode try to convert the inline codes if ( originalTuId != null ) { // At this point the fragment should not be segmented nor have any inline codes GenericContent.fromLetterCodedToFragment(frag.getCodedText(), frag, false, true); } else { // Else: Normal PO entry // Sets the inline codes if ( params.getUseCodeFinder() ) { params.getCodeFinder().process(frag); } } return frag; }
qr.source = GenericContent.fromLetterCodedToFragment((String)map.get("source"), null, false, true); qr.target = GenericContent.fromLetterCodedToFragment((String)map.get("target"), null, false, true);
TextFragment srcFrag = GenericContent.fromLetterCodedToFragment(tmp, null, false, true); if ( srcSegs == null ) { srcSegs = tu.getSourceSegments(); TextFragment trgFrag = GenericContent.fromLetterCodedToFragment(tmp, null, false, true);