Class GoogleMTv2Connector

    • Constructor Detail

      • GoogleMTv2Connector

        public GoogleMTv2Connector()
      • GoogleMTv2Connector

        public GoogleMTv2Connector​(GoogleMTAPI api)
    • Method Detail

      • setParameters

        public void setParameters​(IParameters params)
        Description copied from interface: IQuery
        Sets the parameters for opening and querying this connector.
        Specified by:
        setParameters in interface IQuery
        Overrides:
        setParameters in class BaseConnector
        Parameters:
        params - the parameters to set.
      • close

        public void close()
        Description copied from interface: IQuery
        Closes this connector.
      • getName

        public String getName()
        Description copied from interface: IQuery
        Gets the name of the connector.
        Returns:
        the name of the connector.
      • getSettingsDisplay

        public String getSettingsDisplay()
        Description copied from interface: IQuery
        Gets 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.
      • open

        public void open()
        Description copied from interface: IQuery
        Opens this query engine.
      • query

        public int query​(String plainText)
        Description copied from interface: IQuery
        Starts 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 frag)
        Description copied from interface: IQuery
        Starts a query for a given text.
        Parameters:
        frag - The text to query.
        Returns:
        The number of hits for the given query.
      • batchQueryText

        public List<List<QueryResult>> batchQueryText​(List<String> plainTexts)
        Description copied from interface: IQuery
        Starts a batch query for a given list of plain texts.
        Note that batchQueryText does not use hasNext and next methods. Callers must use the returned list directly.
        Specified by:
        batchQueryText in interface IQuery
        Overrides:
        batchQueryText in class BaseConnector
        Parameters:
        plainTexts - list of the plain texts to translate.
        Returns:
        a list of lists of query result. Each list corresponds to a source text (in the same order)
      • batchQuery

        public List<List<QueryResult>> batchQuery​(List<TextFragment> fragments)
        Description copied from class: BaseConnector
        Slow default implementation using query!! Override to take advantage of servers batch API
        Specified by:
        batchQuery in interface IQuery
        Overrides:
        batchQuery in class BaseConnector
        Parameters:
        fragments - list of the text fragments to translate.
        Returns:
        a list of lists of query result. Each list corresponds to a source text (in the same order)
      • getSupportedLanguages

        public List<LocaleId> getSupportedLanguages()
      • convertGoogleLanguageCode

        protected LocaleId convertGoogleLanguageCode​(String lang)
      • leverage

        public void leverage​(ITextUnit tu)
        Description copied from interface: IQuery
        Leverages a text unit (segmented or not) based on the current settings. Any options or attributes needed must be set before calling this method.
        Specified by:
        leverage in interface IQuery
        Overrides:
        leverage in class BaseConnector
        Parameters:
        tu - the text unit to leverage.
      • batchLeverage

        public void batchLeverage​(List<ITextUnit> tuList)
        Description copied from class: BaseConnector
        Slow default implementation using leverage(TextUnit). Override in sub-class if you want a custom batchLeverage
        Specified by:
        batchLeverage in interface IQuery
        Overrides:
        batchLeverage in class BaseConnector
        Parameters:
        tuList - list of the text units to process.
      • toInternalCode

        protected String toInternalCode​(LocaleId locale)
        Description copied from class: BaseConnector
        Converts 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:
        toInternalCode in class BaseConnector
        Parameters:
        locale - the locale identifier to convert.
        Returns:
        the internal string code for language/locale code for this connector.