com.aspose.ocr

## Class LanguageContainer

- java.lang.Object
- - com.aspose.ocr.LanguageContainer

- All Implemented Interfaces:
    Iterable<ILanguage>

      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");

- - ### Method Summary

    Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### addLanguage

          public void addLanguage(ILanguage language)

      Adds to the collection recognition language. If such language is already in the collection, it added again.

      Parameters:
        `language` - The `ILanguage` object to add.

    - #### get

          public ILanguage get(int index)

      Gets language by index.

      Parameters:
        `index` - Index of language.
      Returns:
        `ILanguage` instance.

    - #### getCount

          public int getCount()

      Gets total count of languages in container.

      Returns:
        total count of languages in container

    - #### getLanguage

          public ILanguage getLanguage(String language)

      Gets the language from the collection.

      Parameters:
        `language` - Name of language.
      Returns:
        The `ILanguage` object.
      Throws:
        `OcrException` - The specified language does not exist.

    - #### iterator

          public Iterator<ILanguage> iterator()

      Gets enumerator that can be used to loop through the collection.

      Specified by:
        `iterator` in interface `Iterable<ILanguage>`
      Returns:
        Enumerator object.

    - #### set

          public void set(int index,
                 ILanguage value)

      Sets language by index.

      Parameters:
        `index` - Index of language.
        `value` - instance.

Copyright © 2014. All rights reserved.