Package net.sf.okapi.connectors.apertium
Class ApertiumMTConnector
- java.lang.Object
-
- net.sf.okapi.lib.translation.BaseConnector
-
- net.sf.okapi.connectors.apertium.ApertiumMTConnector
-
- All Implemented Interfaces:
AutoCloseable,Iterator<QueryResult>,IQuery
public class ApertiumMTConnector extends BaseConnector
-
-
Constructor Summary
Constructors Constructor Description ApertiumMTConnector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this connector.StringgetName()Gets the name of the connector.ParametersgetParameters()Gets the current parameters of this connector.StringgetSettingsDisplay()Gets a display representation of the current settings for this connector.voidopen()Opens this query engine.intquery(String plainText)Starts a query for a give plain text.intquery(TextFragment fragment)Queries the Apertium API.voidsetParameters(IParameters params)Sets the parameters for opening and querying this connector.protected StringtoInternalCode(LocaleId standardCode)Converts a locale identifier to the internal string value for a language/locale code for this connector.-
Methods inherited from class net.sf.okapi.lib.translation.BaseConnector
batchLeverage, batchLeverageUsingBatchQuery, batchQuery, batchQueryText, clearAttributes, getNoQueryThreshold, getSourceLanguage, getTargetLanguage, getWeight, hasNext, leverage, leverageUsingBatchQuery, next, removeAttribute, setAttribute, setLanguages, setNoQueryThreshold, setRootDirectory, setWeight
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:IQueryGets the name of the connector.- Returns:
- the name of the connector.
-
getSettingsDisplay
public String getSettingsDisplay()
Description copied from interface:IQueryGets a display representation of the current settings for this connector. This can be a display of some of the parameters for example, or some explanations about default non-modifiable settings.- Returns:
- a display representation of the current settings.
-
close
public void close()
Description copied from interface:IQueryCloses this connector.
-
open
public void open()
Description copied from interface:IQueryOpens this query engine.
-
query
public int query(String plainText)
Description copied from interface:IQueryStarts a query for a give plain text.- Parameters:
plainText- text to query.- Returns:
- The number of hits for the given query.
-
query
public int query(TextFragment fragment)
Queries the Apertium API. See http://wiki.apertium.org/wiki/Apertium_web_service for details.- Parameters:
fragment- the fragment to query.- Returns:
- the number of translations (1 or 0).
-
toInternalCode
protected String toInternalCode(LocaleId standardCode)
Description copied from class:BaseConnectorConverts a locale identifier to the internal string value for a language/locale code for this connector. By default, this simply returns the string of the given LocaleId.- Overrides:
toInternalCodein classBaseConnector- Parameters:
standardCode- the locale identifier to convert.- Returns:
- the internal string code for language/locale code for this connector.
-
getParameters
public Parameters getParameters()
Description copied from interface:IQueryGets the current parameters of this connector.- Specified by:
getParametersin interfaceIQuery- Overrides:
getParametersin classBaseConnector- Returns:
- the current parameters of this connector or null if no parameters are used.
-
setParameters
public void setParameters(IParameters params)
Description copied from interface:IQuerySets the parameters for opening and querying this connector.- Specified by:
setParametersin interfaceIQuery- Overrides:
setParametersin classBaseConnector- Parameters:
params- the parameters to set.
-
-