extract_generic: Extract Generic Entities From Phrase

extract_genericR Documentation

Extract Generic Entities From Phrase

Description

This function searches a phrase for the position and length of expressions specified in a dictionary. This is called within other main functions of the package and generally not intended for use on its own.

Usage

extract_generic(phrase, dict)

Arguments

phrase

Text to search.

dict

data.frame, the first column should contain expressions to find. These can be regular expressions or exact phrases.

Details

extract_generic is used to extract entities that are identified with an associated dictionary of phrases or regular expressions, such as dose change, frequency, intake time, route, or duration in medExtractR and medExtractR_tapering, as well as dose schedule, time keyword, transition, and preposition in medExtractR_tapering. This function is called within extract_entities.

Value

A numeric matrix with position and expression length.

Examples

data(frequency_vals)
extract_generic("take two every day", dict = frequency_vals)
extract_generic("take two every morning",
                  dict = data.frame(c("morning", "every morning")))

medExtractR documentation built on June 7, 2022, 1:08 a.m.