Learn R Programming

fastText

The fastText R package is an interface to the fastText library for efficient learning of word representations and sentence classification. More details on the functionality of fastText can be found in the

The official website of the fasttext algorithm includes more details regarding the supervised & unsupervised functions. The following image shows the difference between cbow and skipgram (models to compute word representations)

Moreover, the following figure - extracted from a survey (scientific paper) related to word embeddings and recent advancements in Large Language Models - shows the differences between static and contextualized word embeddings

You can either install the package from CRAN using,


install.packages("fastText")
 

or from Github using the install_github function of the remotes package,


remotes::install_github('mlampros/fastText')

or directly download the fastText-zip file using the Clone or download button in the repository page, extract it locally (rename it to fastText if necessary and check that files such as DESCRIPTION, NAMESPACE etc. are present when you open the fastText folder) and then run,


#-------------
# on a Unix OS
#-------------

setwd('/your_folder/fastText/')
Rcpp::compileAttributes(verbose = TRUE)
setwd('/your_folder/')
system("R CMD build fastText")
system("R CMD INSTALL fastText_1.0.1.tar.gz")


#------------------
# on the Windows OS  
#------------------

setwd('C:/your_folder/fastText/')
Rcpp::compileAttributes(verbose = TRUE)
setwd('C:/your_folder/')
system("R CMD build fastText")
system("R CMD INSTALL fastText_1.0.1.tar.gz")

Use the following link to report bugs/issues (for the R package port),

https://github.com/mlampros/fastText/issues

Citation:

If you use the fastText R package in your paper or research please cite both fastText and the original articles / software https://CRAN.R-project.org/package=fastText:

@Manual{,
  title = {{fastText}: Efficient Learning of Word Representations and
    Sentence Classification using R},
  author = {Lampros Mouselimis},
  year = {2021},
  note = {R package version 1.0.4},
  url = {https://CRAN.R-project.org/package=fastText},
}

Copy Link

Version

Install

install.packages('fastText')

Monthly Downloads

312

Version

1.0.4

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Lampros Mouselimis

Last Published

February 17th, 2024

Functions in fastText (1.0.4)

printQuantizeUsage

Print Usage Information when the command equals to 'quantize'
printTestLabelUsage

Print Usage Information when the command equals to 'test-label'
compute_elapsed_time

elapsed time in hours & minutes & seconds
fasttext_interface

Interface for the fasttext library
printPredictUsage

Print Usage Information when the command equals to 'predict' or 'predict-prob'
printPrintNgramsUsage

Print Usage Information when the command equals to 'print-ngrams'
plot_progress_logs

Plot the progress of loss, learning-rate and word-counts
print_parameters

Print the parameters for a specific command
printAnalogiesUsage

Print Usage Information when the command equals to 'analogies'
printDumpUsage

Print Usage Information when the command equals to 'dump'
printNNUsage

Print Usage Information when the command equals to 'nn'
language_identification

Language Identification using fastText
give_args_fasttext

The Rcpp function which is used in the 'fasttext_interface' R function
multiplot

Multiple plot function
printPrintSentenceVectorsUsage

Print Usage Information when the command equals to 'print-sentence-vectors'
printPrintWordVectorsUsage

Print Usage Information when the command equals to 'print-word-vectors'
inner_elapsed_time

inner function of 'compute_elapsed_time'
printTestUsage

Print Usage Information when the command equals to 'test'
printUsage

Print Usage Information for all parameters