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.
This class inherits from GenericPipe
and implements the
pipe
abstract function.
bdpar::GenericPipe
-> SlangPipe
new()
Creates a SlangPipe
object.
SlangPipe$new(
propertyName = "langpropname",
propertyLanguageName = "language",
alwaysBeforeDeps = list("GuessLanguagePipe"),
notAfterDeps = list(),
replaceSlangs = TRUE,
resourcesSlangsPath = NULL
)
propertyName
A character
value. Name of the property
associated with the GenericPipe
.
propertyLanguageName
A character
value. Name of the
language property.
alwaysBeforeDeps
A list
value. The dependencies
alwaysBefore (GenericPipes
that must be executed before
this one).
notAfterDeps
A list
value. The dependencies
notAfter (GenericPipes
that cannot be executed after
this one).
replaceSlangs
A logical
value. Indicates if
the slangs are replaced or not.
resourcesSlangsPath
A character
value. Path
of resource files (in json format) containing the correspondence between
slangs and meaning.
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
.
SlangPipe$pipe(instance)
instance
A Instance
value. The Instance
to preprocess.
The Instance
with the modifications that have
occurred in the pipe.
findSlang()
Checks if the slang is in the data.
SlangPipe$findSlang(data, slang)
data
A character
value. The text where slang
will be searched.
slang
A character
value. Indicates the
slang to find.
A logical
value depending on whether the
slang is in the data.
replaceSlang()
Replaces the slang in the data for the extendedSlang.
SlangPipe$replaceSlang(slang, extendedSlang, data)
slang
A character
value. Indicates the
slang to replace.
extendedSlang
A character
value. Indicates the
string to replace for the slangs found.
data
A character
value. The text where slang
will be replaced.
The data with the slangs replaced.
getPropertyLanguageName()
Gets the name of property language.
SlangPipe$getPropertyLanguageName()
Value of name of property language.
getResourcesSlangsPath()
Gets the path of slangs resources.
SlangPipe$getResourcesSlangsPath()
Value of path of slangs resources.
setResourcesSlangsPath()
Sets the path of slangs resources.
SlangPipe$setResourcesSlangsPath(path)
path
A character
value. The new value of the path of
slangs resources.
clone()
The objects of this class are cloneable with this method.
SlangPipe$clone(deep = FALSE)
deep
Whether to make a deep clone.
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.
AbbreviationPipe
, bdpar.Options
,
ContractionPipe
, File2Pipe
,
FindEmojiPipe
, FindEmoticonPipe
,
FindHashtagPipe
, FindUrlPipe
,
FindUserNamePipe
, GuessDatePipe
,
GuessLanguagePipe
, Instance
,
InterjectionPipe
, MeasureLengthPipe
,
GenericPipe
, ResourceHandler
,
StopWordPipe
, StoreFileExtPipe
,
TargetAssigningPipe
, TeeCSVPipe
,
ToLowerCasePipe