Skip to content

Commit 6e67253

Browse files
committed
perf: remove reset_encoding
1 parent 59ed8aa commit 6e67253

File tree

12 files changed

+16
-48
lines changed

12 files changed

+16
-48
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
^.*\.Rproj$
22
^\.Rproj\.user$
33
^\.github$
4+
^\.vscode$
45
^\.Rprofile$
56
^\.covrignore$
67
^doc$
78
^Meta$
89
^docs$
910
^codecov\.yml$
11+
^renovate\.json$
1012
^README\.Rmd$
1113
^crfpp$
1214
^cabocha$

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ Meta
4242
*.log
4343
*.pdf
4444

45+
.vscode

DESCRIPTION

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: pipian
33
Title: Tiny Interface to CaboCha for R
4-
Version: 0.3.7
4+
Version: 0.3.8
55
Authors@R: c(
66
person("Akiru", "Kato", , "paithiov909@gmail.com", role = c("aut", "cre")),
77
person("Marcin", "Kalicinski", role = "aut",
@@ -15,9 +15,9 @@ License: MIT + file LICENSE
1515
URL: https://github.com/paithiov909/pipian,
1616
https://paithiov909.github.io/pipian/
1717
BugReports: https://github.com/paithiov909/pipian/issues
18-
Depends:
18+
Depends:
1919
R (>= 4.0.0)
20-
Imports:
20+
Imports:
2121
dplyr,
2222
igraph,
2323
purrr,
@@ -32,9 +32,8 @@ Suggests:
3232
roxygen2,
3333
spelling,
3434
testthat (>= 3.0.0)
35-
LinkingTo:
36-
Rcpp,
37-
RcppThread
35+
LinkingTo:
36+
Rcpp
3837
Config/testthat/edition: 3
3938
Encoding: UTF-8
4039
Language: en-US

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# pipian 0.3.8
2+
3+
* For performance, now skips resetting the output encodings to UTF-8.
4+
15
# pipian 0.3.4
26

37
* Dropped `processx` dependency.

R/RcppExports.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ parse_xml <- function(path) {
77

88
# Register entry points for exported C++ functions
99
methods::setLoadAction(function(ns) {
10-
.Call('_pipian_RcppExport_registerCCallable', PACKAGE = 'pipian')
10+
.Call(`_pipian_RcppExport_registerCCallable`)
1111
})

R/cabocha-parser.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ ppn_parse_xml <- function(path,
5858
sentence_id = as.integer(.data$sentence_id) + 1L,
5959
chunk_id = as.integer(.data$chunk_id) + 1L,
6060
token_id = as.integer(.data$token_id),
61-
token = reset_encoding(.data$token),
61+
token = .data$token,
6262
chunk_link = as.integer(.data$chunk_link) + 1L,
6363
chunk_score = as.numeric(.data$chunk_score),
6464
chunk_head = as.integer(.data$chunk_head) + 1L,
6565
chunk_func = as.integer(.data$chunk_func),
66-
token_entity = dplyr::na_if(reset_encoding(.data$token_entity), "O")
66+
token_entity = dplyr::na_if(.data$token_entity, "O")
6767
) %>%
6868
dplyr::select(!"token_feature") %>%
6969
dplyr::bind_cols(features) %>%

R/utils.R

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
#' Format character vector
2-
#' @param vec Character vector.
3-
#' @param enc Encoding of `vec`.
4-
#' @returns Formatted character vector is returned.
5-
#' @keywords internal
6-
reset_encoding <- function(vec, enc = "UTF-8") {
7-
unlist(lapply(vec, function(elem) {
8-
Encoding(elem) <- enc
9-
return(elem)
10-
}))
11-
}
12-
131
#' Check if CaboCha command is available
142
#' @returns Logical.
153
#' @keywords internal

inst/include/pipian_RcppExports.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#ifndef RCPP_pipian_RCPPEXPORTS_H_GEN_
55
#define RCPP_pipian_RCPPEXPORTS_H_GEN_
66

7-
#include <RcppThread.h>
87
#include <Rcpp.h>
98

109
namespace pipian {

man/reset_encoding.Rd

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/RcppExports.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
33

44
#include "../inst/include/pipian.h"
5-
#include <RcppThread.h>
65
#include <Rcpp.h>
76
#include <string>
87
#include <set>

src/parsexml.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// [[Rcpp::depends(RcppThread)]]
2-
#define RCPPTHREAD_OVERRIDE_THREAD 1
3-
41
#include <Rcpp.h>
52
#include <fstream>
63
#include "./rapidxml-1.13/rapidxml.hpp"

tests/testthat/test-cabocha-exec.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
skip_if_not(is_cabocha_available())
2-
31
test_that("can execute cabocha", {
2+
skip_if_not(is_cabocha_available())
43
expect_type(ppn_cabocha(enc2utf8("\u3053\u3093\u306b\u3061\u306f")), "character")
54
})

0 commit comments

Comments
 (0)