Learn R Programming

bdpar (version 1.0.1)

AbbreviationPipe: Class to find and/or replace the abbreviations on the data field of an Instance

Description

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

Usage

AbbreviationPipe

Arguments

Constructor

AbbreviationPipe$new(propertyName = "abbreviation",
                     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 abbreviations. The abbreviations found in the Pipe are added to the list of properties of the Instance. If the replaceAbbreviations parameter is TRUE, the Instance data will be modified by replacing the abbreviations found.

    • Usage: pipe(instance, replaceAbbreviations = TRUE)

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

    • Arguments:

      • instance: (Instance) Instance to preproccess.

      • replaceAbbreviations: (logical) indicates if the abbreviations are replaced or not.

  • findAbbreviation: checks if the abbreviation is in the data.

    • Usage: findAbbreviation(data, abbreviation)

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

    • Arguments:

      • data: (character) text where abbreviation will be searched.

      • abbreviation: (character) indicates the abbreviation to find.

  • replaceAbbreviation: replaces the abbreviation in the data for the extendedAbbreviation.

    • Usage: replaceAbbreviation(abbreviation, extendedAbbreviation, data)

    • Value: the data with the abbreviatons replaced.

    • Arguments:

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

      • extendedAbbreviation: (character) indicates the string to replace for the abbreviations found.

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

  • getPropertyLanguageName: gets of name of property language.

    • Usage: getPropertyLanguageName()

    • Value: value of name of property language.

  • getResourcesAbbreviationsPath: gets of path of abbreviations resources.

    • Usage: getResourcesAbbreviationsPath()

    • Value: value of path of abbreviations resources.

  • setResourcesAbbreviationsPath: sets the path of abbreviations resources.

    • Usage: setResourcesAbbreviationsPath(path)

    • Arguments:

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

Private fields

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

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

Details

AbbreviationPipe class requires the resource files (in json format) containing the correspondence between abbreviations and meaning. To this end, the language of the text indicated in the propertyLanguageName should be contained in the resource file name (ie. abbrev.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]

resourcesAbbreviationsPath = <<resources_abbreviations_path>>

See Also

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