Package net.sf.okapi.steps.wordcount
Class CharacterCounter
- java.lang.Object
-
- net.sf.okapi.steps.wordcount.common.BaseCounter
-
- net.sf.okapi.steps.wordcount.CharacterCounter
-
public class CharacterCounter extends BaseCounter
Character Count engine. Contains static methods to calculate number of characters in a given text fragment.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCharacterCounter.Counts
-
Constructor Summary
Constructors Constructor Description CharacterCounter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static longcount(Object text, LocaleId language)protected longdoCountImpl(String text, LocaleId language)CharacterCounter.CountsdoFullCount(Object text, LocaleId language)protected CharacterCounter.CountsdoFullCountImpl(String text, LocaleId language)static CharacterCounter.CountsfullCount(Object text, LocaleId language)static longgetCount(ITextUnit tu)Returns the character count information stored by CharacterCountStep in the source part of a given text unit.static longgetCount(ITextUnit tu, int segIndex)Returns the character count information stored by CharacterCountStep in a given segment of the source part of a given text unit.static longgetCount(Segment segment)Returns the character count information stored by CharacterCountStep in a given segment of the source part of a given text unit.protected StringgetMetricNameForRetrieval()static voidsetCount(IWithAnnotations res, long count)-
Methods inherited from class net.sf.okapi.steps.wordcount.common.BaseCounter
doCount, doGetCount, doGetCount, doGetCount, getCount, getCount, getCount
-
-
-
-
Method Detail
-
doFullCount
public CharacterCounter.Counts doFullCount(Object text, LocaleId language)
-
doCountImpl
protected long doCountImpl(String text, LocaleId language)
- Specified by:
doCountImplin classBaseCounter
-
doFullCountImpl
protected CharacterCounter.Counts doFullCountImpl(String text, LocaleId language)
-
setCount
public static void setCount(IWithAnnotations res, long count)
-
getMetricNameForRetrieval
protected String getMetricNameForRetrieval()
- Specified by:
getMetricNameForRetrievalin classBaseCounter
-
fullCount
public static CharacterCounter.Counts fullCount(Object text, LocaleId language)
-
getCount
public static long getCount(ITextUnit tu)
Returns the character count information stored by CharacterCountStep in the source part of a given text unit.- Parameters:
tu- the given text unit- Returns:
- number of characters (0 if no character count information found)
-
getCount
public static long getCount(ITextUnit tu, int segIndex)
Returns the character count information stored by CharacterCountStep in a given segment of the source part of a given text unit.- Parameters:
tu- the given tusegIndex- index of the segment in the source- Returns:
- number of characters (0 if no character count information found)
-
getCount
public static long getCount(Segment segment)
Returns the character count information stored by CharacterCountStep in a given segment of the source part of a given text unit.- Parameters:
segment- the given segment- Returns:
- number of characters (0 if no character count information found)
-
-