rflashtext

FlashText algorithm implementation for faster finding and replacing of words in a text

https://github.com/abrja/rflashtext

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.4%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

FlashText algorithm implementation for faster finding and replacing of words in a text

Basic Info
Statistics
  • Stars: 8
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 3
Created about 4 years ago · Last pushed almost 3 years ago
Metadata Files
Readme License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# rflashtext


[![R-CMD-check](https://github.com/AbrJA/rflashtext/workflows/R-CMD-check/badge.svg)](https://cran.r-project.org/web/checks/check_results_rflashtext.html)
[![Grand-total](https://cranlogs.r-pkg.org/badges/grand-total/rflashtext)](https://github.com/AbrJA/rflashtext/actions)
[![Per-month](https://cranlogs.r-pkg.org/badges/rflashtext)](https://CRAN.R-project.org/package=rflashtext)


_rflashtext_ **can be used to find and replace words in a given text with only one pass over the document.** 

It's a R implementation of the [FlashText algorithm](https://arxiv.org/abs/1711.00046) and it's inspired on the python library [flashtext](https://github.com/vi3k6i5/flashtext).

## Installation

You can install the released version of rflashtext from [CRAN](https://CRAN.R-project.org/package=rflashtext) with:

``` r
install.packages("rflashtext")
```

And the development version from [GitHub](https://github.com/AbrJA/rflashtext) with:

```r
install.packages("devtools")
devtools::install_github("AbrJA/rflashtext")
```
## Example

This is a basic example which shows you how to use the API:

### New processor

```{r new}
library(rflashtext)

processor <- KeywordProcessor$new(keys = c("NY", "LA"), words = c("New York", "Los Angeles"))
processor$show_trie()
```

### Add keys-words to processor

```{r add}
processor$add_keys_words(keys = c("TX", "CA"), words = c("Texas", "California"))
processor$show_trie()
```

### Find keys in a sentence

```{r}
words_found <- processor$find_keys(sentences = c("I live in LA and I like NY", "Have you been in TX?"))
words_found
data.table::rbindlist(words_found)
```

### Replace keys in a sentence

```{r}
processor$replace_keys(sentences = c("I live in LA and I like NY", "Have you been in TX?"))
```

To see more details about the performance of the algorithm, click [here](https://github.com/AbrJA/rflashtext_benchmark).

Owner

  • Name: Abraham Jaimes
  • Login: AbrJA
  • Kind: user
  • Location: Queretaro

Data Scientist

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 2
  • Total pull requests: 5
  • Average time to close issues: 3 days
  • Average time to close pull requests: 2 minutes
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • AbrJA (2)
Pull Request Authors
  • AbrJA (5)
Top Labels
Issue Labels
bug (2)
Pull Request Labels
bug (2) documentation (1) enhancement (1)

Packages

  • Total packages: 1
  • Total downloads:
    • cran 146 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: rflashtext

FlashText Algorithm for Finding and Replacing Words

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 146 Last month
Rankings
Stargazers count: 19.8%
Forks count: 28.8%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 40.6%
Downloads: 89.1%
Maintainers (1)
Last synced: over 1 year ago

Dependencies

DESCRIPTION cran
  • R6 * imports
  • testthat >= 3.0.0 suggests