Class MachineLearningServiceImpl

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void generateDatasetForAwsComprehend​(java.lang.String filePath, java.lang.String langCode, java.lang.String targetDb, java.lang.String targetCollection, java.lang.Boolean isAbsolutePath)
      This method automatically generate a dataset from existing list of terms
      void generateTranslationsForLanguage​(java.lang.String fromLangIsoCode, java.lang.String toLangIsoCode)
      This method generates new database entities for new language.
      private java.lang.String getBlockText​(com.amazonaws.services.textract.model.Block block, java.util.List<com.amazonaws.services.textract.model.Block> blocks)  
      private java.lang.String getCellBlockValue​(java.lang.Integer fromIndex, java.util.List<com.amazonaws.services.textract.model.Block> blocks)  
      private java.lang.String getDatasetItemDescription​(java.util.List<java.lang.String> searchTerms, java.lang.String snippet)  
      private java.lang.String getKeyBlockValue​(com.amazonaws.services.textract.model.Block block, java.util.List<com.amazonaws.services.textract.model.Block> blocks)  
      private java.util.Set<java.lang.String> getSkuId​(java.lang.String line, com.amazonaws.services.comprehend.AmazonComprehend comprehendClient)  
      private java.util.List<com.google.api.services.customsearch.v1.model.Result> googleCustomSearch​(java.lang.String keyword, java.lang.String langCode)  
      java.util.Map<java.lang.String,​java.lang.Object> recognizeAttributesForSellerSku​(java.util.ArrayList<java.lang.String> urls, java.lang.String sellerSkuType, java.lang.Boolean isAbsolutePath)
      This method is working with AWS and it automatically does a recognition a seller sku object from files
      private java.util.Map<java.lang.String,​java.lang.Object> recognizeSellerSku​(java.util.List<com.amazonaws.services.textract.model.Block> blocks, com.amazonaws.services.comprehend.AmazonComprehend comprehendClient)  
      void translateDatabaseForLanguage​(java.lang.String fromLangIsoCode, java.lang.String toLangIsoCode, java.lang.String targetDb, java.lang.String targetCollection, java.util.ArrayList<java.lang.String> fieldNames)
      This method generates new database entities for new language.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MachineLearningServiceImpl

        public MachineLearningServiceImpl()
    • Method Detail

      • recognizeAttributesForSellerSku

        public java.util.Map<java.lang.String,​java.lang.Object> recognizeAttributesForSellerSku​(java.util.ArrayList<java.lang.String> urls,
                                                                                                      java.lang.String sellerSkuType,
                                                                                                      java.lang.Boolean isAbsolutePath)
        Description copied from interface: MachineLearningService
        This method is working with AWS and it automatically does a recognition a seller sku object from files
        Specified by:
        recognizeAttributesForSellerSku in interface MachineLearningService
        Parameters:
        urls - path of file which will be parsed
        sellerSkuType - type of SellerSKU
        isAbsolutePath - this is a switcher for the url construction
        Returns:
        it returns a SellerSKU
      • generateDatasetForAwsComprehend

        public void generateDatasetForAwsComprehend​(java.lang.String filePath,
                                                    java.lang.String langCode,
                                                    java.lang.String targetDb,
                                                    java.lang.String targetCollection,
                                                    java.lang.Boolean isAbsolutePath)
        Description copied from interface: MachineLearningService
        This method automatically generate a dataset from existing list of terms
        Specified by:
        generateDatasetForAwsComprehend in interface MachineLearningService
        Parameters:
        filePath - the text file with the list of terms
        langCode - language code
        targetDb - the database which will be used to save a dataset
        targetCollection - the collection which will be used to save a dataset
        isAbsolutePath - this is a switcher for the url construction
      • generateTranslationsForLanguage

        @Transactional
        @Async("asyncTaskExecutor")
        public void generateTranslationsForLanguage​(java.lang.String fromLangIsoCode,
                                                    java.lang.String toLangIsoCode)
        Description copied from interface: MachineLearningService
        This method generates new database entities for new language.
        Specified by:
        generateTranslationsForLanguage in interface MachineLearningService
        Parameters:
        fromLangIsoCode - the language id which will be used as reference
        toLangIsoCode - the language id which will be used for translation entity generation
      • translateDatabaseForLanguage

        @Transactional
        @Async("asyncTaskExecutor")
        public void translateDatabaseForLanguage​(java.lang.String fromLangIsoCode,
                                                 java.lang.String toLangIsoCode,
                                                 java.lang.String targetDb,
                                                 java.lang.String targetCollection,
                                                 java.util.ArrayList<java.lang.String> fieldNames)
        Description copied from interface: MachineLearningService
        This method generates new database entities for new language.
        Specified by:
        translateDatabaseForLanguage in interface MachineLearningService
        Parameters:
        fromLangIsoCode - the language id which will be used as reference
        toLangIsoCode - the language id which will be used for translation entity generation
        targetDb - the database which will be used to translate
        targetCollection - the collection which will be used to translate
        fieldNames - the list of fields which should be translated
      • googleCustomSearch

        private java.util.List<com.google.api.services.customsearch.v1.model.Result> googleCustomSearch​(java.lang.String keyword,
                                                                                                        java.lang.String langCode)
      • getDatasetItemDescription

        private java.lang.String getDatasetItemDescription​(java.util.List<java.lang.String> searchTerms,
                                                           java.lang.String snippet)
      • recognizeSellerSku

        private java.util.Map<java.lang.String,​java.lang.Object> recognizeSellerSku​(java.util.List<com.amazonaws.services.textract.model.Block> blocks,
                                                                                          com.amazonaws.services.comprehend.AmazonComprehend comprehendClient)
      • getBlockText

        private java.lang.String getBlockText​(com.amazonaws.services.textract.model.Block block,
                                              java.util.List<com.amazonaws.services.textract.model.Block> blocks)
      • getKeyBlockValue

        private java.lang.String getKeyBlockValue​(com.amazonaws.services.textract.model.Block block,
                                                  java.util.List<com.amazonaws.services.textract.model.Block> blocks)
      • getCellBlockValue

        private java.lang.String getCellBlockValue​(java.lang.Integer fromIndex,
                                                   java.util.List<com.amazonaws.services.textract.model.Block> blocks)
      • getSkuId

        private java.util.Set<java.lang.String> getSkuId​(java.lang.String line,
                                                         com.amazonaws.services.comprehend.AmazonComprehend comprehendClient)