Skip to content

Commit e20bfb1

Browse files
committed
add boundary class
1 parent ea318d9 commit e20bfb1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

R/classes.R

+20
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ setClass(
2626
)
2727
)
2828

29+
setClass(
30+
"boundary",
31+
representation(
32+
value = "character"
33+
)
34+
)
35+
2936
fixed <- function(x, ignore_case = FALSE) {
3037
new("fixed", value = x, ignore_case = ignore_case)
3138
}
@@ -85,3 +92,16 @@ get_coll <- function(x) {
8592

8693
x@value
8794
}
95+
96+
boundary <- function(x) {
97+
if (is.null(x)) {
98+
return(NULL)
99+
}
100+
switch(
101+
x,
102+
"word" = get_boundary_word(),
103+
"sentence" = get_boundary_sentence(),
104+
"line_break" = get_boundary_linebreak(),
105+
"character" = get_boundary_character()
106+
)
107+
}

0 commit comments

Comments
 (0)