Package net.sf.okapi.connectors.bifile
Class BilingualFileConnector
- java.lang.Object
-
- net.sf.okapi.lib.translation.BaseConnector
-
- net.sf.okapi.connectors.pensieve.PensieveTMConnector
-
- net.sf.okapi.connectors.bifile.BilingualFileConnector
-
- All Implemented Interfaces:
AutoCloseable,Iterator<QueryResult>,IQuery,ITMQuery
public class BilingualFileConnector extends PensieveTMConnector
This connector extendsPensieveTMConnectorto allow one-step leveraging from a bilingual file. Upon initialization it imports the specified input file into a temporary Pensieve TM, and points its superclass to it. All actual queries are handled by the superclass.
-
-
Constructor Summary
Constructors Constructor Description BilingualFileConnector()
-
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 text)Starts a query for a given text.voidsetLanguages(LocaleId sourceLocale, LocaleId targetLocale)Sets the source and target languages for this query engine.voidsetParameters(IParameters params)Sets the parameters for opening and querying this connector.-
Methods inherited from class net.sf.okapi.connectors.pensieve.PensieveTMConnector
clearAttributes, getMaximumHits, getThreshold, hasNext, next, removeAttribute, setAttribute, setMaximumHits, setRootDirectory, setThreshold
-
Methods inherited from class net.sf.okapi.lib.translation.BaseConnector
batchLeverage, batchLeverageUsingBatchQuery, batchQuery, batchQueryText, getNoQueryThreshold, getSourceLanguage, getTargetLanguage, getWeight, leverage, leverageUsingBatchQuery, setNoQueryThreshold, setWeight, toInternalCode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.okapi.common.query.IQuery
batchLeverage, batchQuery, batchQueryText, getNoQueryThreshold, getSourceLanguage, getTargetLanguage, getWeight, leverage, setNoQueryThreshold, setWeight
-
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.- Specified by:
getNamein interfaceIQuery- Overrides:
getNamein classPensieveTMConnector- 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.- Specified by:
getSettingsDisplayin interfaceIQuery- Overrides:
getSettingsDisplayin classPensieveTMConnector- Returns:
- a display representation of the current settings.
-
query
public int query(String plainText)
Description copied from interface:IQueryStarts a query for a give plain text.- Specified by:
queryin interfaceIQuery- Overrides:
queryin classPensieveTMConnector- Parameters:
plainText- text to query.- Returns:
- The number of hits for the given query.
-
query
public int query(TextFragment text)
Description copied from interface:IQueryStarts a query for a given text.- Specified by:
queryin interfaceIQuery- Overrides:
queryin classPensieveTMConnector- Parameters:
text- The text to query.- Returns:
- The number of hits for the given query.
-
open
public void open()
Description copied from interface:IQueryOpens this query engine.- Specified by:
openin interfaceIQuery- Overrides:
openin classPensieveTMConnector
-
close
public void close()
Description copied from interface:IQueryCloses this connector.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIQuery- Overrides:
closein classPensieveTMConnector
-
setLanguages
public void setLanguages(LocaleId sourceLocale, LocaleId targetLocale)
Description copied from interface:IQuerySets the source and target languages for this query engine.- Specified by:
setLanguagesin interfaceIQuery- Overrides:
setLanguagesin classPensieveTMConnector- Parameters:
sourceLocale- Code of the source locale.targetLocale- Code of the target locale.
-
getParameters
public Parameters getParameters()
Description copied from interface:IQueryGets the current parameters of this connector.- Specified by:
getParametersin interfaceIQuery- Overrides:
getParametersin classPensieveTMConnector- 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 classPensieveTMConnector- Parameters:
params- the parameters to set.
-
-