Learn R Programming

bdpar (version 1.0.1)

Bdpar: Class to manage the preprocess of the files throughout the flow of pipes

Description

Bdpar class provides the static variables required to perform the whole data flow process. To this end Bdpar is in charge of (i) loading the configuration parameters (from configurationsTemplate.ini or the user configuration file) and (ii) executing the flow of pipes (inherited from TypePipe class) passed as argument.

Usage

Bdpar

Arguments

Constructor

Bdpar$new(configurationFilePath = NULL, editConfigurationFile = FALSE)

  • Arguments:

    • configurationFilePath: (character) path where the configuration file is located. The file must have the .ini extension. In the case that the argument is null, the default configuration file (configurationsTemplate.ini) will be used.

    • editConfigurationFile: (boolean) indicates if open an editor to change the configuration file or not.

Static variables

  • connections: (Connections) object that handles the connections with YouTube and Twitter.

  • configurationFilePath: (character) path where the configuration file is located. The file must have the .ini extension. In the case that the argument is null, the default configuration file (configurationsTemplate.ini) will be used. ,

  • resourceHandler: (ResourceHandler) object that handles the json resources files.

Methods

  • proccess_files: preprocess files through the indicated flow of pipes.

    • Usage:

      proccess_files(filesPath,
                     pipe = SerialPipe$new(),
                     instanceFactory = InstanceFactory$new())

    • Value: list of Instances that have been preprocessed.

    • Arguments:

      • filesPath: (character) path where the files to be processed are located.

      • pipe: (TypePipe) subclass of TypePipe, which implements the pipe method.

      • instanceFactory: (InstanceFactory) class which implements the method createInstance to choose which type of Instance is created.

Details

The configuration file can be indicated by the user or use the default configuration file (configurationsTemplate.ini). In addition, once we call the Bdpar constructor, it will be possible to choose if the user wants to edit the file of indicated configurations or not.

The configurationFilePath file should have the following structure (Depends on the Pipes used). Also the configurationsTemplate.ini has this structure:

[twitter]

ConsumerKey = <<consumer_key>>

ConsumerSecret = <<consumer_secret>>

AccessToken = <<access_token>>

AccessTokenSecret = <<access_token_secret>>

[youtube]

app_id = <<app_id>>

app_password = <<app_password>>

[eml]

PartSelectedOnMPAlternative = <<part_selected>> (text/html or text/plain)

[resourcesPath]

resourcesAbbreviationsPath = <<resources_abbreviations_path>>

resourcesContractionsPath = <<resources_contractions_path>>

resourcesInterjectionsPath = <<resources_interjections_path>>

resourcesSlangsPath = <<resources_slangs_path>>

resourcesStopWordsPath = <<resources_stopWords_path>>

[CSVPath]

outPutTeeCSVPipePath = <<out_put_teeCSVPipe_path>>

[cache]

cachePathTwtid = <<cache_path_twtid>>

cachePathYtbid = <<cache_path_ytbid>>

See Also

Connections, Instance, InstanceFactory, pipeline_execute, TypePipe, SerialPipe

Examples

Run this code
# NOT RUN {
#Path where the configuration file are located
configurationFilePath <- system.file(file.path("examples",
                                               "configurationsExample.ini"),
                                     package ="bdpar")

#Folder with the files to preprocess
filesPath <- system.file(file.path("examples",
                                   "testFiles"),
                         package = "bdpar")

#Object which indicates the pipes' flow
pipe <- SerialPipe$new()

#Object which decides how creates the instances
instanceFactory <- InstanceFactory$new()

objectBdpar <- Bdpar$new(configurationFilePath)

#Starting file preprocessing...
objectBdpar$proccess_files(filesPath, pipe, instanceFactory)
# }

Run the code above in your browser using DataLab