Learn R Programming

flashlighttext (version 0.1.0)

Dictionary: Dictionary

Description

Dictionary

Dictionary

Arguments

Value

Dictionary

Active bindings

ptr

has a single parameter new_ptr that accepts a new pointer to a Dictionary. It returns invisible(NULL)

Methods


Method new()

Usage

Dictionary$new(tokens = NULL)

Arguments

tokens

file or list containing valid tokens. If using a file, the expected format is for tokens mapping to the same index to be on the same line

Examples

library(flashlighttext)

dict <- Dictionary$new(letters) dict$get_entry(0) dict$get_index("b") dict$map_indices_to_entries(1:3) dict$entry_size() dict$add_entry("A") dict$contains("A")


Method entry_size()

Usage

Dictionary$entry_size()

Returns

invisible(NULL)


Method index_size()

Usage

Dictionary$index_size()

Returns

invisible(NULL)


Method add_entry()

Usage

Dictionary$add_entry(entry, idx = NULL)

Arguments

entry

an entry

idx

an idx

Returns

invisible(NULL)


Method get_index()

Usage

Dictionary$get_index(entry)

Arguments

entry

an entry

Returns

the index


Method get_entry()

Usage

Dictionary$get_entry(idx)

Arguments

idx

an index

Returns

the entry


Method contains()

Usage

Dictionary$contains(entry)

Arguments

entry

an entry

Returns

a boolean


Method map_indices_to_entries()

Usage

Dictionary$map_indices_to_entries(indices)

Arguments

indices

a vector of indices

Returns

a vector


Method map_entries_to_indices()

Usage

Dictionary$map_entries_to_indices(entries)

Arguments

entries

a vector of entries

Returns

a vector


Method is_contiguous()

Usage

Dictionary$is_contiguous()

Returns

a boolean


Method set_default_index()

Usage

Dictionary$set_default_index(idx)

Arguments

idx

one index

Returns

invisible(NULL)


Method clone()

The objects of this class are cloneable with this method.

Usage

Dictionary$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

Run this code

## ------------------------------------------------
## Method `Dictionary$new`
## ------------------------------------------------

library(flashlighttext)

dict <- Dictionary$new(letters)
dict$get_entry(0)
dict$get_index("b")
dict$map_indices_to_entries(1:3)
dict$entry_size()
dict$add_entry("A")
dict$contains("A")

Run the code above in your browser using DataLab