public final class LanguageContainer extends Object implements Iterable<ILanguage>
This is container for recognition languages. It needs to set a set of recognition languages.
Recognition of multiple languages. The text is recognized by words. Each recognized word has a specific language. There is priority of recognition languages. Language that was added earlier to the collection has a higher priority. If the word is identical in several languages, a language that was earlier added to the collection will be selected.
OcrEngine ocr = new OcrEngine(); ocr.getLanguages().addLanguage(Language.load("english")); ocr.getLanguages().addLanguage(Language.load("spain")); ILanguage language = ocr.getLanguages().getLanguage("spain");
| Modifier and Type | Method and Description |
|---|---|
void |
addLanguage(ILanguage language)
Adds to the collection recognition language.
|
ILanguage |
get(int index)
Gets language by index.
|
int |
getCount()
Gets total count of languages in container.
|
ILanguage |
getLanguage(String language)
Gets the language from the collection.
|
Iterator<ILanguage> |
iterator()
Gets enumerator that can be used to loop through the collection.
|
void |
set(int index,
ILanguage value)
Sets language by index.
|
public void addLanguage(ILanguage language)
Adds to the collection recognition language. If such language is already in the collection, it added again.
language - The ILanguage object to add.public ILanguage get(int index)
Gets language by index.
index - Index of language.ILanguage instance.public int getCount()
Gets total count of languages in container.
public ILanguage getLanguage(String language)
Gets the language from the collection.
language - Name of language.ILanguage object.OcrException - The specified language does not exist.public Iterator<ILanguage> iterator()
Gets enumerator that can be used to loop through the collection.
public void set(int index,
ILanguage value)
Sets language by index.
index - Index of language.value - instance.Copyright © 2014. All rights reserved.