properties: Instantiate and manage properties.

Description Usage Arguments Details Examples

View source: R/properties.R

Description

StanfordCoreNLP uses a Properties class object for the settings to configure the parser. This includes the number of threads to use, an output directory etc. The properties function instantiates this Java object from a properties file or a list. A set of auxiliary functions can be used to set and get properties relevant for the workflow envisaged by this package.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17

Arguments

x

Path of a propeties file or named list of properties.

p

A properties object.

k

The number of threads used to process files. Needs to be a reasonable value, but need not be an integer value as value will be coerced to character vector anyway.

dir

The output directory for processed data.

fmt

The output format to use, a length-one character vector. Use 'json' for JSON output.

Details

The properties() function will instantiate a properties object from a (named) list or a character vector with the path to a properties file.

The parse_properties_file() function instantiates a properties object from a properties file or a named list.

The number of threads used to process files in parallel is defined by the property 'threads'. Auxiliary functions properties_get_threads() and properties_set_threads() get and set the value.

Examples

 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
# Instantiate properties from properties file

props_german <- system.file(
  package = "bignlp",
  "extdata", "properties_files",
  "corenlp-german-fast.properties"
)
plist <- parse_properties_file(props_german)
props <- properties(plist)


# Instantiate properties from list

properties <- list(
  "annotators" = "tokenize, ssplit, pos, lemma, ner",
  "tokenize.language" = "de",
  "pos.model" = "edu/stanford/nlp/models/pos-tagger/german-ud.tagger",
  "ner.model" = "edu/stanford/nlp/models/ner/german.distsim.crf.ser.gz",
  "ner.applyNumericClassifiers" = "false",
  "ner.applyFineGrained" = "false",
  "ner.useSUTime" = "false",
  "outputFormat" = "json",
  "outputDirectory" = "/Users/andreasblaette/Lab/tmp/corenlp/json"
)
props

PolMine/bignlp documentation built on Jan. 29, 2021, 1:14 a.m.