public class WordCounter extends BaseCounter
| Constructor and Description |
|---|
WordCounter() |
| Modifier and Type | Method and Description |
|---|---|
static long |
count(ITextUnit textUnit,
LocaleId language)
Counts words in the source part of a given text unit.
|
static long |
count(Segment segment,
LocaleId language)
Counts words in a given segment.
|
static long |
count(String string,
LocaleId language)
Counts words in a given string.
|
static long |
count(TextContainer textContainer,
LocaleId language)
Counts words in a given text container.
|
static long |
count(TextFragment textFragment,
LocaleId language)
Counts words in a given text fragment.
|
static long |
countFromLogographicCharacterCount(long characterCount,
LocaleId language)
For "logographic" languages, GMX-V 2.0 defines factors by which the character count
should be divided in order to yield the word count.
|
static long |
countLogographicScript(Object text,
LocaleId language)
For "logographic" languages, GMX-V 2.0 defines factors by which the character count
should be divided in order to yield the word count.
|
protected long |
doCountImpl(String text,
LocaleId language) |
static long |
getCount(ITextUnit tu)
Returns the word count information stored by WordCountStep in the source part of a given text unit.
|
static long |
getCount(ITextUnit tu,
int segIndex)
Returns the word count information stored by WordCountStep in a given segment of the source part of a given text unit.
|
static long |
getCount(IWithAnnotations res)
Returns the word count information stored by WordCountStep in annotations of a given resource.
|
static long |
getCount(Segment segment)
Returns the word count information stored by WordCountStep in a given segment of the source part of a given text unit.
|
static long |
getCount(TextContainer tc)
Returns the word count information stored by WordCountStep in the given text container.
|
protected String |
getMetricNameForRetrieval() |
static void |
setCount(IWithAnnotations res,
long count) |
doCount, doGetCount, doGetCount, doGetCount, getCount, getCount, getCountprotected long doCountImpl(String text, LocaleId language)
doCountImpl in class BaseCounterpublic static long countLogographicScript(Object text, LocaleId language)
The result will be 0 if the language is logographic but does not have
a character count factor defined (GMX.getCharacterCountFactor(LocaleId) returns
-1d). In this case word counts are not meaningful for the supplied language.
This method will throw IllegalArgumentException if the supplied language is
not a logographic script (GMX.isLogographicScript(LocaleId) returns
false).
public static long countFromLogographicCharacterCount(long characterCount,
LocaleId language)
The result will be 0 if the language is logographic but does not have
a character count factor defined (GMX.getCharacterCountFactor(LocaleId) returns
-1d). In this case word counts are not meaningful for the supplied language.
This method will throw IllegalArgumentException if the supplied language is
not a logographic script (GMX.isLogographicScript(LocaleId) returns
false).
public static long count(ITextUnit textUnit, LocaleId language)
textUnit - the given text unitlanguage - the language of the sourcepublic static long count(TextContainer textContainer, LocaleId language)
textContainer - the given text containerlanguage - the language of the textpublic static long count(Segment segment, LocaleId language)
segment - the given segmentlanguage - the language of the textpublic static long count(TextFragment textFragment, LocaleId language)
textFragment - the given text fragmentlanguage - the language of the textpublic static long count(String string, LocaleId language)
string - the given stringlanguage - the language of the textprotected String getMetricNameForRetrieval()
getMetricNameForRetrieval in class BaseCounterpublic static long getCount(IWithAnnotations res)
res - the given resourcepublic static long getCount(ITextUnit tu)
tu - the given text unitpublic static long getCount(TextContainer tc)
tc - the given text containerpublic static long getCount(ITextUnit tu, int segIndex)
tu - the given tusegIndex - index of the segment in the sourcepublic static long getCount(Segment segment)
segment - the given segmentpublic static void setCount(IWithAnnotations res, long count)
Copyright © 2021. All rights reserved.