| hf_ez_token_classification | R Documentation |
Usually used for sentence parsing, either grammatical, or Named Entity Recognition (NER) to understand keywords contained within text.
hf_ez_token_classification(
model_id = "dbmdz/bert-large-cased-finetuned-conll03-english",
use_api = FALSE
)
model_id |
A model_id. Run hf_search_models(...) for model_ids. Defaults to 'dbmdz/bert-large-cased-finetuned-conll03-english'. |
use_api |
Whether to use the Inference API to run the model (TRUE) or download and run the model locally (FALSE). Defaults to FALSE |
A text2text generation object
https://huggingface.co/docs/api-inference/detailed_parameters#token-classification-task
## Not run:
# Load the default named entity recognition model
ez <- hf_ez_token_classification()
# Run NER. Note how the full name is aggregated into one named entity.
ez$infer(
string = "My name is Sarah Jessica Parker but you can call me Jessica",
aggregation_strategy = "simple"
)
# Run NER without aggregation.
# Note how the full name is separated into distinct named entities.
ez$infer(
string = "My name is Sarah Jessica Parker but you can call me Jessica",
aggregation_strategy = "none"
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.