Skip to content

Commit 8bbf683

Browse files
Andreas BlätteAndreas Blätte
authored andcommitted
Zenodo DOI updated
1 parent a5e5f72 commit 8bbf683

File tree

2 files changed

+15
-23
lines changed

2 files changed

+15
-23
lines changed

README.Rmd

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
output: github_document
33
---
44

5-
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5939368.svg)](https://doi.org/10.5281/zenodo.5939368)
5+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7040475.svg)](https://doi.org/10.5281/zenodo.7040475)
66
[![License: GPL v3](http://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
77
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/RcppCWB)](https://cran.r-project.org/package=RcppCWB)
88
[![R build status](https://github.com/PolMine/RcppCWB/workflows/R-CMD-check/badge.svg)](https://github.com/PolMine/RcppCWB/actions)
@@ -93,11 +93,7 @@ RcppCWB includes a small sample corpus called ('REUTERS'). After loading the pac
9393

9494
```{r initialize_RcppCWB}
9595
library(RcppCWB)
96-
if (!check_pkg_registry_files()){
97-
registry <- use_tmp_registry()
98-
} else {
99-
registry <- get_pkg_registry()
100-
}
96+
registry <- use_tmp_registry()
10197
```
10298

10399
To start with, we get the number of tokens of the corpus.
@@ -124,21 +120,21 @@ To get the corpus positions of a token.
124120

125121
```{r get_corpus_positions}
126122
token_to_get <- "oil"
127-
id_oil <- cl_str2id(corpus = "REUTERS", p_attribute = "word", str = token_to_get)
128-
cpos_oil <- cl_id2cpos <- cl_id2cpos(corpus = "REUTERS", p_attribute = "word", id = id_oil)
123+
id_oil <- cl_str2id(corpus = "REUTERS", p_attribute = "word", str = token_to_get, registry = registry)
124+
cpos_oil <- cl_id2cpos <- cl_id2cpos(corpus = "REUTERS", p_attribute = "word", id = id_oil, registry = registry)
129125
```
130126

131127
Get the frequency of token.
132128

133129
```{r get_token_frequency}
134-
oil_freq <- cl_id2freq(corpus = "REUTERS", p_attribute = "word", id = id_oil)
130+
oil_freq <- cl_id2freq(corpus = "REUTERS", p_attribute = "word", id = id_oil, registry = registry)
135131
```
136132

137133
Using regular expressions.
138134

139135
```{r regex}
140-
ids <- cl_regex2id(corpus = "REUTERS", p_attribute = "word", regex = "M.*")
141-
m_words <- cl_id2str(corpus = "REUTERS", p_attribute = "word", id = ids)
136+
ids <- cl_regex2id(corpus = "REUTERS", p_attribute = "word", regex = "M.*", registry = registry)
137+
m_words <- cl_id2str(corpus = "REUTERS", p_attribute = "word", id = ids, registry = registry)
142138
```
143139
To use the CQP syntax, we need to initialize CQP first.
144140

README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5939368.svg)](https://doi.org/10.5281/zenodo.5939368)
2+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7040475.svg)](https://doi.org/10.5281/zenodo.7040475)
33
[![License: GPL
44
v3](http://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
55
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/RcppCWB)](https://cran.r-project.org/package=RcppCWB)
@@ -124,11 +124,7 @@ with a temporary registry.
124124

125125
``` r
126126
library(RcppCWB)
127-
if (!check_pkg_registry_files()){
128-
registry <- use_tmp_registry()
129-
} else {
130-
registry <- get_pkg_registry()
131-
}
127+
registry <- use_tmp_registry()
132128
```
133129

134130
To start with, we get the number of tokens of the corpus.
@@ -157,21 +153,21 @@ To get the corpus positions of a token.
157153

158154
``` r
159155
token_to_get <- "oil"
160-
id_oil <- cl_str2id(corpus = "REUTERS", p_attribute = "word", str = token_to_get)
161-
cpos_oil <- cl_id2cpos <- cl_id2cpos(corpus = "REUTERS", p_attribute = "word", id = id_oil)
156+
id_oil <- cl_str2id(corpus = "REUTERS", p_attribute = "word", str = token_to_get, registry = registry)
157+
cpos_oil <- cl_id2cpos <- cl_id2cpos(corpus = "REUTERS", p_attribute = "word", id = id_oil, registry = registry)
162158
```
163159

164160
Get the frequency of token.
165161

166162
``` r
167-
oil_freq <- cl_id2freq(corpus = "REUTERS", p_attribute = "word", id = id_oil)
163+
oil_freq <- cl_id2freq(corpus = "REUTERS", p_attribute = "word", id = id_oil, registry = registry)
168164
```
169165

170166
Using regular expressions.
171167

172168
``` r
173-
ids <- cl_regex2id(corpus = "REUTERS", p_attribute = "word", regex = "M.*")
174-
m_words <- cl_id2str(corpus = "REUTERS", p_attribute = "word", id = ids)
169+
ids <- cl_regex2id(corpus = "REUTERS", p_attribute = "word", regex = "M.*", registry = registry)
170+
m_words <- cl_id2str(corpus = "REUTERS", p_attribute = "word", id = ids, registry = registry)
175171
```
176172

177173
To use the CQP syntax, we need to initialize CQP first.
@@ -189,7 +185,7 @@ cqp_initialize(registry = registry)
189185
cqp_query(corpus = "REUTERS", query = '"crude" "oil"')
190186
```
191187

192-
## NULL
188+
## <pointer: 0x600001c743c0>
193189

194190
``` r
195191
cpos <- cqp_dump_subcorpus(corpus = "REUTERS")

0 commit comments

Comments
 (0)