Title: | Detect and Parse Historic Dates |
---|---|
Description: | Automatically converts language-specific verbal information, e.g., "1st half of the 19th century," to its standardized numerical counterparts, e.g., "1801-01-01/1850-12-31." It follows the recommendations of the 'MIDAS' ('Marburger Informations-, Dokumentations- und Administrations-System'), see <doi:10.11588/artdok.00003770>. |
Authors: | Stefanie Schneider [cre, aut] |
Maintainer: | Stefanie Schneider <[email protected]> |
License: | GPL-3 |
Version: | 0.2.1 |
Built: | 2024-11-26 04:52:23 UTC |
Source: | https://github.com/stefanieschneider/unstruwwel |
Set a Century and Get its Time Interval
Set a Century and Get its Time Interval
An Object of R6Class
with methods to set
common time periods and specifications for centuries.
unstruwwel::Periods
-> Century
new()
Helper function to specify the beginning of a century.
Helper function to specify the middle of a century.
Helper function to specify the end of a century.
Create a century.
Century$new(value)
value
A numerical scalar.
Object of R6Class
with methods to set
common time periods and specifications for centuries.
clone()
The objects of this class are cloneable with this method.
Century$clone(deep = FALSE)
deep
Whether to make a deep clone.
if (interactive()) { x <- Century$new(15) x$take(2, type = "third") }
if (interactive()) { x <- Century$new(15) x$take(2, type = "third") }
Set a Decade and Get its Time Interval
Set a Decade and Get its Time Interval
An Object of R6Class
with methods to set
common time periods and specifications for decades.
unstruwwel::Periods
-> Decade
new()
Helper function to specify the beginning of a decade.
Helper function to specify the middle of a decade.
Helper function to specify the end of a decade.
Create a decade.
Decade$new(value, official_def = FALSE)
value
A numerical scalar.
official_def
If 'TRUE', the official definition that begins with the year 1 is used.
Object of R6Class
with methods to set
common time periods and specifications for decades.
clone()
The objects of this class are cloneable with this method.
Decade$clone(deep = FALSE)
deep
Whether to make a deep clone.
if (interactive()) { x <- Decade$new(1520) x$take(1, type = "half") }
if (interactive()) { x <- Decade$new(1520) x$take(1, type = "half") }
A dataset containing the names, date orders, stop words, simplifications, and replacements of 4 languages.
data(languages)
data(languages)
A tibble with 4 rows and 5 variables.
A dataset containing eight thousand standardization examples of the MIDAS (Marburger Informations-, Dokumentations- und Administrations-System).
data(midas)
data(midas)
A vector of length 8115.
Set a Period and Get its Time Interval
Set a Period and Get its Time Interval
An Object of R6Class
with methods to set
common time periods and specifications for time periods.
.interval
Stores a time interval.
fuzzy
Either '-1' (approximate) or '1' (uncertain).
express
Either '-1' (before) or '1' (after).
.interval
Stores a time interval.
interval
Convert and return a POSIXt time interval.
time_span
Convert and return a time span in years.
iso_format
Convert and return a date in ISO 8601.
new()
Helper function to specify a time period.
Create a time period.
Periods$new(...)
...
Intervals, numerical scalars, or objects of
class Period
.
x
A numerical scalar. The range of valid values
depends on type
. If type
is "early"
,
"mid"
, or "late"
, x
is ignored.
type
A character scalar. The following values
are supported: "early"
, "mid"
, "late"
,
"quarter"
, "third"
, and "half"
. If
type
is 'NULL', x
defines a year or decade.
set_additions()
Set additions for a time period.
Periods$set_additions(x)
x
A character vector.
take()
Specify a period.
Periods$take(x = NA, type = NA, ignore_errors = FALSE)
x
A numerical scalar. The range of valid values
depends on type
. If type
is "early"
,
"mid"
, or "late"
, x
is ignored.
type
A character scalar. The following values
are supported: "early"
, "mid"
, "late"
,
"quarter"
, "third"
, and "half"
. If
type
is 'NULL', x
defines a year or decade.
ignore_errors
If 'TRUE', error messages are ignored.
Object of R6Class
with methods to set
common time periods and specifications for time periods.
clone()
The objects of this class are cloneable with this method.
Periods$clone(deep = FALSE)
deep
Whether to make a deep clone.
A dataset containing the values, schemes, and languages for over three thousand language-specific scheme variants.
data(schemes)
data(schemes)
A tibble with 3583 rows and 3 variables.
Detect and Parse Historic Dates, e.g., to ISO 8601:2-2019.
unstruwwel( x, language = NULL, verbose = TRUE, scheme = "time-span", fuzzify = c(0, 0) )
unstruwwel( x, language = NULL, verbose = TRUE, scheme = "time-span", fuzzify = c(0, 0) )
x |
Input vector. Either a character vector, or something coercible to one. |
language |
Language code of the input vector as defined in
ISO 639-1. If |
verbose |
If |
scheme |
Scheme code of the output list. Either |
fuzzify |
A numerical vector of length 2 to extend the interval
of approximate or uncertain time periods. This is only applied if
|
A named list of vectors or objects of R6Class
.
Although multiple languages can be detected, only dominant ones are ultimately set.
if (interactive()) { unstruwwel("1. Hälfte 19. Jahrhundert", language = "de") unstruwwel("circa between 1901 and 1905", language = "en") }
if (interactive()) { unstruwwel("1. Hälfte 19. Jahrhundert", language = "de") unstruwwel("circa between 1901 and 1905", language = "en") }
Set a Year and Get its Time Interval
Set a Year and Get its Time Interval
An Object of R6Class
with methods to set
common time periods and specifications for years.
unstruwwel::Periods
-> Year
new()
Helper function to specify a time period.
Helper function to specify a season.
Helper function to specify a month.
Create a year.
Year$new(value)
value
A numerical scalar.
Object of R6Class
with methods to set
common time periods and specifications for years.
take()
Specify a year.
Year$take(x = NA, type = NA, ignore_errors = FALSE)
x
A numerical scalar. The range of valid values
depends on type
. If type
is "spring"
,
"summer"
, "autumn"
, or "winter"
,
x
is ignored.
type
A character scalar. The following values are
supported: "spring"
, "summer"
, "autumn"
,
"winter"
, and all English-language months.
ignore_errors
If 'TRUE', error messages are ignored.
Object of R6Class
with methods to set
common time periods and specifications for years.
clone()
The objects of this class are cloneable with this method.
Year$clone(deep = FALSE)
deep
Whether to make a deep clone.
if (interactive()) { x <- Year$new(1520) x$take(15, type = "june") }
if (interactive()) { x <- Year$new(1520) x$take(15, type = "june") }