Question Answering STILL UNDER DEVELOPMENT

textQA(
  question,
  context,
  model = "",
  device = "cpu",
  tokenizer_parallelism = FALSE,
  logging_level = "warning",
  return_incorrect_results = FALSE,
  topk = 1,
  doc_stride = 128,
  max_answer_len = 15,
  max_seq_len = 384,
  max_question_len = 64,
  handle_impossible_answer = FALSE
)

Arguments

question

(string) A question

context

(string) The context(s) where the model will look for the answer.

model

(string) HuggingFace name of a pre-trained language model that have been fine-tuned on a question answering task.

device

(string) Device to use: 'cpu', 'gpu', or 'gpu:k' where k is a specific device number

tokenizer_parallelism

(boolean) If TRUE this will turn on tokenizer parallelism.

logging_level

(string) Set the logging level. Options (ordered from less logging to more logging): critical, error, warning, info, debug

return_incorrect_results

(boolean) Many models are not created to be able to provide question -- answering, so this setting stops them from returning incorrect results.

topk

(integer) (int) Indicates number of possible answer span(s) to get from the model output.

doc_stride

(integer) If the context is too long to fit with the question for the model, it will be split into overlapping chunks. This setting controls the overlap size.

max_answer_len

(integer) Max answer size to be extracted from the model’s output.

max_seq_len

(integer) The max total sentence length (context + question) in tokens of each chunk passed to the model. If needed, the context is split in chunks (using doc_stride as overlap).

max_question_len

(integer) The max question length after tokenization. It will be truncated if needed.

handle_impossible_answer

(boolean) Whether or not impossible is accepted as an answer.

Value

Answers.

Examples

# \donttest{
#   qa_examples <- textQA(question = "Which colour have trees?",
#     context = "Trees typically have leaves, are mostly green and like water.")
# }