Learn R Programming

bdpar (version 3.1.0)

InterjectionPipe: Class to find and/or remove the interjections on the data field of an Instance

Description

InterjectionPipe class is responsible for detecting the existing interjections in the data field of each Instance. Identified interjections are stored inside the interjection field of Instance class. Moreover if needed, is able to perform inline interjections removement.

Arguments

Inherit

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

Super class

bdpar::GenericPipe -> InterjectionPipe

Methods

Inherited methods


Method new()

Creates a InterjectionPipe object.

Usage

InterjectionPipe$new(
  propertyName = "interjection",
  propertyLanguageName = "language",
  alwaysBeforeDeps = list("GuessLanguagePipe"),
  notAfterDeps = list(),
  removeInterjections = TRUE,
  resourcesInterjectionsPath = NULL
)

Arguments

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).

removeInterjections

A logical value. Indicates if the interjections are removed or not.

resourcesInterjectionsPath

A character value. Path of resource files (in json format) containing the interjections.


Method pipe()

Preprocesses the Instance to obtain/remove the interjections. The interjections found in the data are added to the list of properties of the Instance.

Usage

InterjectionPipe$pipe(instance)

Arguments

instance

A Instance value. The Instance to preprocess.

Returns

The Instance with the modifications that have occurred in the pipe.


Method findInterjection()

Checks if the interjection is in the data.

Usage

InterjectionPipe$findInterjection(data, interjection)

Arguments

data

A character value. The text where interjection will be searched.

interjection

A character value. Indicates the interjection to find.

Returns

A logical value depending on whether the interjection is in the data.


Method removeInterjection()

Removes the interjection in the data.

Usage

InterjectionPipe$removeInterjection(interjection, data)

Arguments

interjection

A character value. Indicates the interjection to remove.

data

A character value. The text where interjection will be removed.

Returns

The data with the interjections removed.


Method getPropertyLanguageName()

Gets the name of property language.

Usage

InterjectionPipe$getPropertyLanguageName()

Returns

Value of name of property language.


Method getResourcesInterjectionsPath()

Gets the path of interjections resources.

Usage

InterjectionPipe$getResourcesInterjectionsPath()

Returns

Value of path of interjections resources.


Method setResourcesInterjectionsPath()

Sets the path of interjections resources.

Usage

InterjectionPipe$setResourcesInterjectionsPath(path)

Arguments

path

A character value. The new value of the path of interjections resources.


Method clone()

The objects of this class are cloneable with this method.

Usage

InterjectionPipe$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

InterjectionPipe class requires the resource files (in json format) containing the list of interjections. To this end, the language of the text indicated in the propertyLanguageName should be contained in the resource file name (ie. interj.xxx.json where xxx is the value defined in the propertyLanguageName ). The location of the resources should be defined in the "resources.interjections.path" field of bdpar.Options variable.

See Also

AbbreviationPipe, bdpar.Options, ContractionPipe, File2Pipe, FindEmojiPipe, FindEmoticonPipe, FindHashtagPipe, FindUrlPipe, FindUserNamePipe, GuessDatePipe, GuessLanguagePipe, Instance, MeasureLengthPipe, GenericPipe, ResourceHandler, SlangPipe, StopWordPipe, StoreFileExtPipe, TargetAssigningPipe, TeeCSVPipe, ToLowerCasePipe