-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
README.Rmd
115 lines (72 loc) · 3.81 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
output: github_document
---
[![tic](https://github.com/mlampros/fastText/workflows/tic/badge.svg?branch=master)](https://github.com/mlampros/fastText/actions)
[![codecov.io](https://codecov.io/github/mlampros/fastText/coverage.svg?branch=master)](https://codecov.io/github/mlampros/fastText?branch=master)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/fastText)](http://cran.r-project.org/package=fastText)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/fastText?color=blue)](http://www.r-pkg.org/pkg/fastText)
<a href="https://www.buymeacoffee.com/VY0x8snyh" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" height="21px" ></a>
[![Dependencies](https://tinyverse.netlify.com/badge/fastText)](https://cran.r-project.org/package=fastText)
## fastText
<br>
The **fastText** R package is an interface to the [fastText](https://github.com/facebookresearch/fastText) library for efficient learning of word representations and sentence classification. More details on the functionality of fastText can be found in the
* [fastText_updated_version](http://mlampros.github.io/2019/04/11/fastText_updated_version/) (blog post)
* [fasttext_language_identification](http://mlampros.github.io/2021/05/14/fasttext_language_identification/) (blog post)
* [package documentation](https://mlampros.github.io/fastText/reference/index.html).
<br>
The [official website of the fasttext algorithm](https://fasttext.cc/) includes more details regarding the supervised & unsupervised functions. The following image shows the difference between [**cbow** and **skipgram**](https://fasttext.cc/docs/en/unsupervised-tutorial.html#advanced-readers-skipgram-versus-cbow) (*models to compute word representations*)
<br>
![](./man/figures/skipgram_vs_cbow.png)
<br>
Moreover, the following figure - extracted from [a survey (scientific paper) related to word embeddings](https://hal.science/hal-03148517/document) and recent advancements in Large Language Models - shows the differences between *static* and *contextualized* word embeddings
<br>
![](./man/figures/static_contextualised_word_embeddings.png)
<br>
You can either install the package from CRAN using,
```R
install.packages("fastText")
```
<br>
or from Github using the *install_github* function of the *remotes* package,
```R
remotes::install_github('mlampros/fastText')
```
<br>
**or** directly download the fastText-zip file using the **Clone or download** button in the [repository page](https://github.com/mlampros/fastText), 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,
```R
#-------------
# 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")
```
<br>
Use the following link to report bugs/issues (for the R package port),
<br><br>
[https://github.com/mlampros/fastText/issues](https://github.com/mlampros/fastText/issues)
<br>
### **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`:
<br>
```R
@Manual{,
title = {{fastText}: Efficient Learning of Word Representations and
Sentence Classification using R},
author = {Lampros Mouselimis},
year = {2021},
note = {R package version 1.0.3},
url = {https://CRAN.R-project.org/package=fastText},
}
```
<br>