ContractionPipe
class is responsible for detecting
the existing contractions in the data field of each Instance
.
Identified contractions are stored inside the contraction field of
Instance
class. Moreover if needed, is able to perform inline
contractions replacement.
This class inherits from GenericPipe
and implements the
pipe
abstract function.
bdpar::GenericPipe
-> ContractionPipe
new()
Creates a ContractionPipe
object.
ContractionPipe$new(
propertyName = "contractions",
propertyLanguageName = "language",
alwaysBeforeDeps = list("GuessLanguagePipe"),
notAfterDeps = list(),
replaceContractions = TRUE,
resourcesContractionsPath = 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).
replaceContractions
A logical
value. Indicates if
the contractions are replaced or not.
resourcesContractionsPath
A character
value. Path
of resource files (in json format) containing the correspondence between
contractions and meaning.
pipe()
Preprocesses the Instance
to obtain/replace
the contractions. The contractions found in the data are added to the
list of properties of the Instance
.
ContractionPipe$pipe(instance)
instance
A Instance
value. The Instance
to preprocess.
The Instance
with the modifications that have
occurred in the pipe.
findContraction()
Checks if the contraction is in the data.
ContractionPipe$findContraction(data, contraction)
data
A character
value. The text where contraction
will be searched.
contraction
A character
value. Indicates the
contraction to find.
A logical
value depending on whether the
contraction is in the data.
replaceContraction()
Replaces the contraction in the data for the extendedContraction.
ContractionPipe$replaceContraction(contraction, extendedContraction, data)
contraction
A character
value. Indicates the
contraction to replace.
extendedContraction
A character
value. Indicates the
string to replace for the contractions found.
data
A character
value. The text where contraction
will be replaced.
The data with the contractions replaced.
getPropertyLanguageName()
Gets the name of property language.
ContractionPipe$getPropertyLanguageName()
Value of name of property language.
getResourcesContractionsPath()
Gets the path of contractions resources.
ContractionPipe$getResourcesContractionsPath()
Value of path of contractions resources.
setResourcesContractionsPath()
Sets the path of contractions resources.
ContractionPipe$setResourcesContractionsPath(path)
path
A character
value. The new value of the path of
contractions resources.
clone()
The objects of this class are cloneable with this method.
ContractionPipe$clone(deep = FALSE)
deep
Whether to make a deep clone.
ContractionPipe
class requires the resource files (in json format)
containing the correspondence between contractions and meaning. To this end,
the language of the text indicated in the propertyLanguageName should
be contained in the resource file name (ie. contr.xxx.json where xxx is the
value defined in the propertyLanguageName ). The location of the
resources should be defined in the "resources.contractions.path"
field of bdpar.Options variable.
AbbreviationPipe
, bdpar.Options
,
File2Pipe
, FindEmojiPipe
,
FindEmoticonPipe
, FindHashtagPipe
,
FindUrlPipe
, FindUserNamePipe
,
GuessDatePipe
, GuessLanguagePipe
,
Instance
, InterjectionPipe
,
MeasureLengthPipe
, GenericPipe
,
ResourceHandler
, SlangPipe
,
StopWordPipe
, StoreFileExtPipe
,
TargetAssigningPipe
, TeeCSVPipe
,
ToLowerCasePipe