Learn R Programming

bdpar (version 1.0.1)

SlangPipe: Class to find and/or replace the slangs on the data field of an Instance

Description

SlangPipe class is responsible for detecting the existing slangs in the data field of each Instance. Identified slangs are stored inside the slang field of Instance class. Moreover if needed, is able to perform inline slangs replacement.

Usage

SlangPipe

Arguments

Constructor

SlangPipe$new(propertyName = "langpropname",
              propertyLanguageName = "language",
              alwaysBeforeDeps = list("GuessLanguagePipe"),
              notAfterDeps = list())
  • Arguments:

    • propertyName: (character) name of the property associated with the Pipe.

    • propertyLanguageName: (character) name of the language property.

    • alwaysBeforeDeps: (list) the dependences alwaysBefore (Pipes that must be executed before this one).

    • notAfterDeps: (list) the dependences notAfter (Pipes that cannot be executed after this one).

Inherit

This class inherits from PipeGeneric and implements the pipe abstract function.

Methods

  • pipe: preprocesses the Instance to obtain/replace the slangs. The slangs found in the Pipe are added to the list of properties of the Instance If the replaceSlangs parameter is TRUE, the Instance data will be modified by replacing the slangs found.

    • Usage: pipe(instance, replaceSlangs = TRUE)

    • Value: the Instance with the modifications that have occurred in the Pipe.

    • Arguments:

      • instance: (Instance) Instance to preproccess.

      • replaceSlangs: (logical) indicate if the slangs are replace or not.

  • findSlang: checks if the slang is in the data.

    • Usage: findSlang(data, slang)

    • Value: boolean, depending on whether the slang is on the data.

    • Arguments:

      • data: (character) text where slang will be searched. slang: (character) indicates the slang to find.

  • replaceSlang: replaces the slang in the data for the extendedSlang.

    • Usage:

      replaceSlang(slang, extendedSlang, data)

    • Value: the data with slangs replaced.

    • Arguments:

      • slang: (character) indicates the slang to replace.

      • extendedSlang: (character) indicates the string to replace for the slangs found.

      • data: (character) text where slang will be replaced.

  • getPropertyLanguageName: gets of name of property language.

    • Usage:

      getPropertyLanguageName()

    • Value: value of name of property language.

  • getResourcesSlangsPath: gets of path of slangs resources.

    • Usage:

      getResourcesSlangsPath()

    • Value:

      value of path of slangs resources.

  • setResourcesSlangsPath: sets the path of slangs resources.

    • Usage: setResourcesSlangsPath(path)

    • Arguments:

      • path: (character) the new value of the path of slangs resources.

Private fields

  • propertyLanguageName: (character) the name of property about language.

  • resourcesSlangsPath: (character) the path where are the resources.

Details

SlangPipe class requires the resource files (in json format) containing the correspondence between slangs and meaning. To this end, the language of the text indicated in the propertyLanguageName should be contained in the resource file name (ie. slang.xxx.json where xxx is the value defined in the propertyLanguageName ). The location of the resources should defined in the resourcesPath section of the configuration file.

[resourcesPath]

resourcesSlangsPath = <<resources_slangs_path>>

See Also

AbbreviationPipe, ContractionPipe, File2Pipe, FindEmojiPipe, FindEmoticonPipe, FindHashtagPipe, FindUrlPipe, FindUserNamePipe, GuessDatePipe, GuessLanguagePipe, Instance, InterjectionPipe, MeasureLengthPipe, PipeGeneric, ResourceHandler, StopWordPipe, StoreFileExtPipe, TargetAssigningPipe, TeeCSVPipe, ToLowerCasePipe