| SlangPipe {bdpar} | R Documentation |
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.
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 be defined in the "resources.slangs.path" field of
bdpar.Options variable.
Note
SlangPipe will automatically invalidate the
Instance whenever the obtained data is empty.
Inherit
This class inherits from GenericPipe and implements the
pipe abstract function.
Super class
bdpar::GenericPipe -> SlangPipe
Methods
Public methods
Inherited methods
Method new()
Creates a SlangPipe object.
Usage
SlangPipe$new(
propertyName = "langpropname",
propertyLanguageName = "language",
alwaysBeforeDeps = list("GuessLanguagePipe"),
notAfterDeps = list(),
replaceSlangs = TRUE,
resourcesSlangsPath = NULL
)Arguments
propertyNameA
charactervalue. Name of the property associated with theGenericPipe.propertyLanguageNameA
charactervalue. Name of the language property.alwaysBeforeDepsA
listvalue. The dependencies alwaysBefore (GenericPipesthat must be executed before this one).notAfterDepsA
listvalue. The dependencies notAfter (GenericPipesthat cannot be executed after this one).replaceSlangsA
logicalvalue. Indicates if the slangs are replaced or not.resourcesSlangsPathA
charactervalue. Path of resource files (in json format) containing the correspondence between slangs and meaning.
Method pipe()
Preprocesses the Instance to obtain/replace
the slangs. The slangs found in the data are added to the
list of properties of the Instance.
Usage
SlangPipe$pipe(instance)
Arguments
Returns
The Instance with the modifications that have
occurred in the pipe.
Method findSlang()
Checks if the slang is in the data.
Usage
SlangPipe$findSlang(data, slang)
Arguments
Returns
A logical value depending on whether the
slang is in the data.
Method replaceSlang()
Replaces the slang in the data for the extendedSlang.
Usage
SlangPipe$replaceSlang(slang, extendedSlang, data)
Arguments
Returns
The data with the slangs replaced.
Method getPropertyLanguageName()
Gets the name of property language.
Usage
SlangPipe$getPropertyLanguageName()
Returns
Value of name of property language.
Method getResourcesSlangsPath()
Gets the path of slangs resources.
Usage
SlangPipe$getResourcesSlangsPath()
Returns
Value of path of slangs resources.
Method setResourcesSlangsPath()
Sets the path of slangs resources.
Usage
SlangPipe$setResourcesSlangsPath(path)
Arguments
pathA
charactervalue. The new value of the path of slangs resources.
Method clone()
The objects of this class are cloneable with this method.
Usage
SlangPipe$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
See Also
AbbreviationPipe, bdpar.Options,
ContractionPipe, File2Pipe,
FindEmojiPipe, FindEmoticonPipe,
FindHashtagPipe, FindUrlPipe,
FindUserNamePipe, GuessDatePipe,
GuessLanguagePipe, Instance,
InterjectionPipe, MeasureLengthPipe,
GenericPipe, ResourceHandler,
StopWordPipe, StoreFileExtPipe,
TargetAssigningPipe, TeeCSVPipe,
ToLowerCasePipe