Package net.sf.okapi.lib.verification
Class AbstractChecker
- java.lang.Object
-
- net.sf.okapi.lib.verification.AbstractChecker
-
- Direct Known Subclasses:
CharactersChecker,GeneralChecker,InlineCodesChecker,LengthChecker,LocalizableChecker,PatternsChecker
public abstract class AbstractChecker extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected GenericContentgenContstatic PatternWORDCHARSstatic PatternWORDCHARS_NONUMBERS
-
Constructor Summary
Constructors Constructor Description AbstractChecker()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(TextContainer tc, String segId, IssueType issueType, String comment, int srcStart, int srcEnd, int trgStart, int trgEnd, double severity, List<Code> codes)voidaddAnnotation(TextContainer tc, String segId, IssueType issueType, String comment, int srcStart, int srcEnd, int trgStart, int trgEnd, double severity, List<Code> codes, String itsType)voidaddAnnotationAndReportIssue(IssueType issueType, ITextUnit tu, TextContainer tc, String segId, String comment, int srcStart, int srcEnd, int trgStart, int trgEnd, double severity, String srcOri, String trgOri, List<Code> codes)voidaddAnnotationAndReportIssue(IssueType issueType, ITextUnit tu, TextContainer tc, String segId, String comment, int srcStart, int srcEnd, int trgStart, int trgEnd, double severity, String srcOri, String trgOri, List<Code> codes, String itsType)static intfromFragmentToGeneric(TextFragment frag, int pos)Converts a position in a coded-text string into the same position when the string display uses generic codes.static intfromOriginalToGeneric(TextFragment frag, int pos)Converts a position in a string display using the original code data into the same position when the string display uses generic codes.static intfromStrippedToGeneric(TextFragment frag, int pos)Converts a position in a string display where codes are stripped into the same position when the string display uses generic codes.static intfromStrippedToString(TextFragment frag, int pos)Converts a position in a string display where codes are stripped into the same position when the string display uses original data.URIgetCurrentDocId()StringgetCurrentSubDocId()protected StringgetDisplay(TextContainer tc)Generates the display string for a source or target text=container.protected StringgetDisplay(TextFragment frag)Generates the display string for a source or target text-fragment (e.g.List<Issue>getIssues()ParametersgetParams()List<String>getSigList()LocaleIdgetSrcLoc()LocaleIdgetTrgLoc()booleanisMonolingual()voidprocessStartDocument(StartDocument sd, List<String> sigList)voidprocessStartSubDocument(StartSubDocument ssd)abstract voidprocessTextUnit(ITextUnit tu)voidreportIssue(IssueType issueType, ITextUnit tu, String segId, String message, int srcStart, int srcEnd, int trgStart, int trgEnd, double severity, String srcOri, String trgOri, List<Code> codes)voidsetAnnotationIds(TextContainer srcCont, TextContainer trgCont)voidstartProcess(LocaleId sourceLocale, LocaleId targetLocale, Parameters params, List<Issue> issues)
-
-
-
Field Detail
-
WORDCHARS
public static final Pattern WORDCHARS
-
WORDCHARS_NONUMBERS
public static final Pattern WORDCHARS_NONUMBERS
-
genCont
protected final GenericContent genCont
-
-
Method Detail
-
fromFragmentToGeneric
public static int fromFragmentToGeneric(TextFragment frag, int pos)
Converts a position in a coded-text string into the same position when the string display uses generic codes.- Parameters:
frag- the text-fragment displayed.pos- the position in the coded-text string- Returns:
- the position when the codes' generic representations are used
-
fromOriginalToGeneric
public static int fromOriginalToGeneric(TextFragment frag, int pos)
Converts a position in a string display using the original code data into the same position when the string display uses generic codes.- Parameters:
frag- the text-fragment displayed.pos- the position when the codes' original data are used- Returns:
- the position when the codes' generic representations are used
-
fromStrippedToGeneric
public static int fromStrippedToGeneric(TextFragment frag, int pos)
Converts a position in a string display where codes are stripped into the same position when the string display uses generic codes.- Parameters:
frag- the text-fragment displayed.pos- the position when the codes are stripped.- Returns:
- the position when the codes' generic representations are used
-
fromStrippedToString
public static int fromStrippedToString(TextFragment frag, int pos)
Converts a position in a string display where codes are stripped into the same position when the string display uses original data.- Parameters:
frag- the text-fragment displayed.pos- the position when the codes are stripped- Returns:
- the position when the codes' original data are used.
-
startProcess
public void startProcess(LocaleId sourceLocale, LocaleId targetLocale, Parameters params, List<Issue> issues)
-
processStartDocument
public void processStartDocument(StartDocument sd, List<String> sigList)
-
processStartSubDocument
public void processStartSubDocument(StartSubDocument ssd)
-
processTextUnit
public abstract void processTextUnit(ITextUnit tu)
-
addAnnotationAndReportIssue
public void addAnnotationAndReportIssue(IssueType issueType, ITextUnit tu, TextContainer tc, String segId, String comment, int srcStart, int srcEnd, int trgStart, int trgEnd, double severity, String srcOri, String trgOri, List<Code> codes)
-
addAnnotationAndReportIssue
public void addAnnotationAndReportIssue(IssueType issueType, ITextUnit tu, TextContainer tc, String segId, String comment, int srcStart, int srcEnd, int trgStart, int trgEnd, double severity, String srcOri, String trgOri, List<Code> codes, String itsType)
-
addAnnotation
public void addAnnotation(TextContainer tc, String segId, IssueType issueType, String comment, int srcStart, int srcEnd, int trgStart, int trgEnd, double severity, List<Code> codes)
-
addAnnotation
public void addAnnotation(TextContainer tc, String segId, IssueType issueType, String comment, int srcStart, int srcEnd, int trgStart, int trgEnd, double severity, List<Code> codes, String itsType)
-
reportIssue
public void reportIssue(IssueType issueType, ITextUnit tu, String segId, String message, int srcStart, int srcEnd, int trgStart, int trgEnd, double severity, String srcOri, String trgOri, List<Code> codes)
-
setAnnotationIds
public void setAnnotationIds(TextContainer srcCont, TextContainer trgCont)
-
getSrcLoc
public LocaleId getSrcLoc()
-
getTrgLoc
public LocaleId getTrgLoc()
-
getCurrentDocId
public URI getCurrentDocId()
-
getCurrentSubDocId
public String getCurrentSubDocId()
-
getParams
public Parameters getParams()
-
isMonolingual
public boolean isMonolingual()
-
getDisplay
protected String getDisplay(TextFragment frag)
Generates the display string for a source or target text-fragment (e.g. a segment).- Parameters:
frag- the fragment to display.- Returns:
- the string representation based on the options (e.g. tags: original data or generic)
-
getDisplay
protected String getDisplay(TextContainer tc)
Generates the display string for a source or target text=container.- Parameters:
tc- the text-container to display.- Returns:
- the string representation based on the options (e.g. tags: original data or generic)
-
-